diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index f5b31164ff..6d9f7e60a7 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -90,7 +90,8 @@ enum static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-matroska; video/webm") + GST_STATIC_CAPS ("audio/x-matroska; video/x-matroska; " + "video/x-matroska-3d; audio/webm; video/webm") ); /* TODO: fill in caps! */ diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 7011ba661b..91d1a1cffe 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -82,7 +82,7 @@ enum static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-matroska") + GST_STATIC_CAPS ("video/x-matroska; video/x-matroska-3d; audio/x-matroska") ); #define COMMON_VIDEO_CAPS \ @@ -2459,6 +2459,8 @@ gst_matroska_mux_start (GstMatroskaMux * mux) GST_MATROSKA_ID_TAGS, 0 }; + const gchar *media_type; + gboolean audio_only; guint64 master, child; GSList *collected; int i; @@ -2491,11 +2493,13 @@ gst_matroska_mux_start (GstMatroskaMux * mux) gst_query_unref (query); } + audio_only = mux->num_v_streams == 0 && mux->num_a_streams > 0; if (!strcmp (mux->doctype, GST_MATROSKA_DOCTYPE_WEBM)) { - ebml->caps = gst_caps_new_empty_simple ("video/webm"); + media_type = (audio_only) ? "audio/webm" : "video/webm"; } else { - ebml->caps = gst_caps_new_empty_simple ("video/x-matroska"); + media_type = (audio_only) ? "audio/x-matroska" : "video/x-matroska"; } + ebml->caps = gst_caps_new_empty_simple (media_type); gst_pad_set_caps (mux->srcpad, ebml->caps); /* we start with a EBML header */ doctype = mux->doctype; @@ -2642,11 +2646,11 @@ gst_matroska_mux_start (GstMatroskaMux * mux) cur = cur->next; } - gst_toc_entry_get_start_stop (((GstTocEntry *) toc_entry-> - subentries->data), &start, NULL); + gst_toc_entry_get_start_stop (((GstTocEntry *) toc_entry->subentries-> + data), &start, NULL); toc_entry->subentries = g_list_reverse (toc_entry->subentries); - gst_toc_entry_get_start_stop (((GstTocEntry *) toc_entry-> - subentries->data), NULL, &stop); + gst_toc_entry_get_start_stop (((GstTocEntry *) toc_entry->subentries-> + data), NULL, &stop); gst_toc_entry_set_start_stop (toc_entry, start, stop); to_write = g_list_append (to_write, toc_entry); @@ -3131,11 +3135,7 @@ gst_matroska_mux_stop_streamheader (GstMatroskaMux * mux) GstEbmlWrite *ebml = mux->ebml_write; streamheader_buffer = gst_ebml_stop_streamheader (ebml); - if (!strcmp (mux->doctype, GST_MATROSKA_DOCTYPE_WEBM)) { - caps = gst_caps_new_empty_simple ("video/webm"); - } else { - caps = gst_caps_new_empty_simple ("video/x-matroska"); - } + caps = gst_caps_copy (mux->ebml_write->caps); s = gst_caps_get_structure (caps, 0); g_value_init (&streamheader, GST_TYPE_ARRAY); g_value_init (&bufval, GST_TYPE_BUFFER); diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c index e54fc87394..5efbf8969b 100644 --- a/gst/matroska/matroska-parse.c +++ b/gst/matroska/matroska-parse.c @@ -87,13 +87,15 @@ enum static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-matroska; video/webm") + GST_STATIC_CAPS ("audio/x-matroska; video/x-matroska; " + "video/x-matroska-3d; audio/webm; video/webm") ); static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-matroska; video/webm") + GST_STATIC_CAPS ("audio/x-matroska; video/x-matroska; " + "video/x-matroska-3d; audio/webm; video/webm") ); static GstFlowReturn gst_matroska_parse_parse_id (GstMatroskaParse * parse, @@ -2523,7 +2525,13 @@ gst_matroska_parse_output (GstMatroskaParse * parse, GstBuffer * buffer, GValue bufval = { 0 }; GstBuffer *buf; - caps = gst_caps_new_empty_simple ("video/x-matroska"); + caps = gst_pad_get_current_caps (parse->common.sinkpad); + /* FIXME: could run typefinding over header and pick better default */ + if (caps == NULL) + caps = gst_caps_new_empty_simple ("video/x-matroska"); + else + caps = gst_caps_make_writable (caps); + s = gst_caps_get_structure (caps, 0); g_value_init (&streamheader, GST_TYPE_ARRAY); g_value_init (&bufval, GST_TYPE_BUFFER); diff --git a/gst/matroska/webm-mux.c b/gst/matroska/webm-mux.c index 933c53bd8c..84d3f6b2bb 100644 --- a/gst/matroska/webm-mux.c +++ b/gst/matroska/webm-mux.c @@ -58,7 +58,7 @@ G_DEFINE_TYPE (GstWebMMux, gst_webm_mux, GST_TYPE_MATROSKA_MUX); static GstStaticPadTemplate webm_src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/webm") + GST_STATIC_CAPS ("video/webm; audio/webm") ); static GstStaticPadTemplate webm_videosink_templ =