diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg index 0decb7f4..7c1b908f 100644 --- a/Makefile.ffmpeg +++ b/Makefile.ffmpeg @@ -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 diff --git a/src/muxer.c b/src/muxer.c index 2caf32a4..9fb71899 100644 --- a/src/muxer.c +++ b/src/muxer.c @@ -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 */ diff --git a/src/muxer.h b/src/muxer.h index ff08b81a..d70c10fe 100644 --- a/src/muxer.h +++ b/src/muxer.h @@ -31,6 +31,7 @@ typedef enum { MC_PASS = 4, MC_RAW = 5, MC_WEBM = 6, + MC_AVMATROSKA = 7, } muxer_container_type_t; typedef enum { diff --git a/src/muxer/muxer_libav.c b/src/muxer/muxer_libav.c index 28b7a73e..70b85774 100644 --- a/src/muxer/muxer_libav.c +++ b/src/muxer/muxer_libav.c @@ -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; diff --git a/src/profile.c b/src/profile.c index b65888b7..9ad6c7ab 100644 --- a/src/profile.c +++ b/src/profile.c @@ -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;