]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
libav muxer: add AVMATROSKA muxer type
authorJaroslav Kysela <perex@perex.cz>
Fri, 17 Oct 2014 07:12:49 +0000 (09:12 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 17 Oct 2014 07:40:28 +0000 (09:40 +0200)
Makefile.ffmpeg
src/muxer.c
src/muxer.h
src/muxer/muxer_libav.c
src/profile.c

index 0decb7f4fbec5f7d0d66e0d2af30bfbc71ab61f5..7c1b908f29c57105f03d3839c992bef0aabb454f 100644 (file)
@@ -57,7 +57,7 @@ EXTLIBS         = libx264 libvorbis libvpx
 COMPONENTS      = avutil avformat avcodec swresample swscale avresample
 DECODERS        = mpeg2video mp2 ac3 eac3 h264 h264_vdpau aac aac_latm vorbis libvorbis
 ENCODERS        = mpeg2video mp2 libx264 libvpx_vp8 libvpx_vp9 aac libaacplus vorbis libvorbis
-MUXERS          = mpegts mpeg2dvd
+MUXERS          = mpegts mpeg2dvd matroska
 
 LIBOGG          = libogg-1.3.2
 LIBOGG_TB       = $(LIBOGG).tar.gz
index 2caf32a47e9ab36adde8bae31de2d8896b0556b3..9fb718995f5c7e43018df58b67c56b4e807e427a 100644 (file)
@@ -40,6 +40,7 @@
 static struct strtab container_audio_mime[] = {
   { "application/octet-stream", MC_UNKNOWN },
   { "audio/x-matroska",         MC_MATROSKA },
+  { "audio/x-matroska",         MC_AVMATROSKA },
   { "audio/webm",               MC_WEBM },
   { "audio/x-mpegts",           MC_MPEGTS },
   { "audio/mpeg",               MC_MPEGPS },
@@ -54,6 +55,7 @@ static struct strtab container_audio_mime[] = {
 static struct strtab container_video_mime[] = {
   { "application/octet-stream", MC_UNKNOWN },
   { "video/x-matroska",         MC_MATROSKA },
+  { "video/x-matroska",         MC_AVMATROSKA },
   { "video/webm",               MC_WEBM },
   { "video/x-mpegts",           MC_MPEGTS },
   { "video/mpeg",               MC_MPEGPS },
@@ -66,13 +68,14 @@ static struct strtab container_video_mime[] = {
  * Name of the container
  */
 static struct strtab container_name[] = {
-  { "unknown",  MC_UNKNOWN },
-  { "matroska", MC_MATROSKA },
-  { "webm",     MC_WEBM },
-  { "mpegts",   MC_MPEGTS },
-  { "mpegps",   MC_MPEGPS },
-  { "pass",     MC_PASS },
-  { "raw",      MC_RAW },
+  { "unknown",    MC_UNKNOWN },
+  { "matroska",   MC_MATROSKA },
+  { "webm",       MC_WEBM },
+  { "mpegts",     MC_MPEGTS },
+  { "mpegps",     MC_MPEGPS },
+  { "pass",       MC_PASS },
+  { "raw",        MC_RAW },
+  { "avmatroska", MC_AVMATROSKA },
 };
 
 
@@ -87,6 +90,7 @@ static struct strtab container_audio_file_suffix[] = {
   { "mpeg", MC_MPEGPS },
   { "bin",  MC_PASS },
   { "bin",  MC_RAW },
+  { "mka",  MC_AVMATROSKA },
 };
 
 
@@ -101,6 +105,7 @@ static struct strtab container_video_file_suffix[] = {
   { "mpeg", MC_MPEGPS },
   { "bin",  MC_PASS },
   { "bin",  MC_RAW },
+  { "mkv",  MC_AVMATROSKA },
 };
 
 
@@ -159,41 +164,6 @@ muxer_container_type2txt(muxer_container_type_t mc)
 }
 
 
-#if 0
-/**
- * Get a list of supported containers
- */
-static int
-muxer_container_add(htsmsg_t *array, int type, const char *text)
-{
-  htsmsg_t *mc;
-
-  mc = htsmsg_create_map();
-  htsmsg_add_str(mc, "name",        muxer_container_type2txt(type));
-  htsmsg_add_str(mc, "description", text);
-  htsmsg_add_msg(array, NULL, mc);
-  return 1;
-}
-
-int
-muxer_container_list(htsmsg_t *array)
-{
-  int c;
-
-  c  = muxer_container_add(array, MC_MATROSKA, "Matroska (mkv)");
-  c += muxer_container_add(array, MC_PASS,     "Same as source (pass through)");
-
-#if ENABLE_LIBAV
-  c += muxer_container_add(array, MC_MPEGTS,   "MPEG-TS");
-
-  c += muxer_container_add(array, MC_MPEGPS,   "MPEG-PS (DVD)");
-#endif
-
-  return c;
-}
-#endif
-
-
 /**
  * Convert a container name to a container type
  */
index ff08b81a0f4d1df4aea33c4b6c3dd90b4c52faa8..d70c10fe63fe86d4b91b1a4a44498bcc7cf4a3d2 100644 (file)
@@ -31,6 +31,7 @@ typedef enum {
   MC_PASS        = 4,
   MC_RAW         = 5,
   MC_WEBM        = 6,
+  MC_AVMATROSKA  = 7,
 } muxer_container_type_t;
 
 typedef enum {
index 28b7a73eb608153e9b5efb5719ed2f63ddc510cb..70b8577440dbb2f683e483a211e9b41aa8eefdeb 100644 (file)
@@ -77,6 +77,7 @@ lav_muxer_add_stream(lav_muxer_t *lm,
 
   switch(lm->m_config.m_type) {
   case MC_MATROSKA:
+  case MC_AVMATROSKA:
     st->time_base.num = 1000000;
     st->time_base.den = 1;
     break;
@@ -110,8 +111,10 @@ lav_muxer_add_stream(lav_muxer_t *lm,
     c->sample_rate   = sri_to_rate(ssc->ssc_sri);
     c->channels      = ssc->ssc_channels;
 
+#if 0
     c->time_base.num = 1;
     c->time_base.den = c->sample_rate;
+#endif
 
     av_dict_set(&st->metadata, "language", ssc->ssc_lang, 0);
 
@@ -120,8 +123,10 @@ lav_muxer_add_stream(lav_muxer_t *lm,
     c->width      = ssc->ssc_width;
     c->height     = ssc->ssc_height;
 
+#if 0
     c->time_base.num  = 1;
     c->time_base.den = 25;
+#endif
 
     c->sample_aspect_ratio.num = ssc->ssc_aspect_num;
     c->sample_aspect_ratio.den = ssc->ssc_aspect_den;
@@ -152,6 +157,7 @@ lav_muxer_support_stream(muxer_container_type_t mc,
 
   switch(mc) {
   case MC_MATROSKA:
+  case MC_AVMATROSKA:
     ret |= SCT_ISAUDIO(type);
     ret |= SCT_ISVIDEO(type);
     ret |= SCT_ISSUBTITLE(type);
@@ -503,6 +509,10 @@ lav_muxer_create(const muxer_config_t *m_cfg)
   case MC_MPEGPS:
     mux_name = "dvd";
     break;
+  case MC_MATROSKA:
+  case MC_AVMATROSKA:
+    mux_name = "matroska";
+    break;
   default:
     mux_name = muxer_container_type2txt(m_cfg->m_type);
     break;
index b65888b7291368a4c5e89a93f1a107d672fe9dbb..9ad6c7ab79e90c37e29b5409774a1fcd0a82d216 100644 (file)
@@ -641,10 +641,11 @@ profile_class_mc_list ( void *o )
 {
   static const struct strtab tab[] = {
     { "Not set",                       MC_UNKNOWN },
-    { "Matroska (mkv)",                MC_MATROSKA, },
-    { "WEBM",                          MC_WEBM, },
-    { "MPEG-TS",                       MC_MPEGTS },
-    { "MPEG-PS (DVD)",                 MC_MPEGPS },
+    { "Matroska (mkv) /built-in",      MC_MATROSKA, },
+    { "WEBM /built-in",                MC_WEBM, },
+    { "MPEG-TS /av-lib",               MC_MPEGTS },
+    { "MPEG-PS (DVD) /av-lib",         MC_MPEGPS },
+    { "Matroska (mkv) /av-lib",        MC_AVMATROSKA },
   };
   return strtab2htsmsg(tab);
 }
@@ -884,6 +885,7 @@ profile_transcode_mc_valid(int mc)
   case MC_WEBM:
   case MC_MPEGTS:
   case MC_MPEGPS:
+  case MC_AVMATROSKA:
     return 1;
   default:
     return 0;