GNOME Bugzilla – Bug 703076
flvdemux: Add flvversion 1 to flash-video caps
Last modified: 2013-07-05 19:03:36 UTC
Created attachment 247771 [details] [review] flvdemux: add flvversion 1 to src - allow using avdec_flv flv current only support flvversion 1. avdec_flv set flvversion as 1 on its sink. But flvdemux does not. So in gst_element_factory_list_filter when the caps are checked if is_subset of the avdec_flv sink template capabilities, the check fails. NB: gst_caps_is_subset relies on gst_structure_is_subset. The latter fails if the superset has more fields than the subset (and even if that condition is removed latter fails in gst_caps_structure_is_superset_field if a field of the superset is not in the subset - but gst_caps_structure_is_superset_field also check that the subset value is a "subset" of the superset adhoc field value, so it is not as simple as switching superset and subset identifiers). With above nota bene diagnosis I hope it makes more sense. NB2: in 0.10 flv sorenson works without this patch . The attached patch let flv1 (here sorenson spark) play via gstreamer (gst-launch-1.0 and totem ). It adds flvversion=1 field to flvdemux when it outputs x-flash-video. ext/libav/gstavcodecmap.c:1008 caps = gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-flash-video", "flvversion", G_TYPE_INT, 1, NULL); listing: 844 templates = gst_element_factory_get_static_pad_templates (factory); 845 for (walk = (GList *) templates; walk; walk = g_list_next (walk)) { 846 GstStaticPadTemplate *templ = walk->data; 847 848 /* we only care about the sink templates */ 849 if (templ->direction == direction) { 850 GstCaps *tmpl_caps; 851 852 /* try to intersect the caps with the caps of the template */ 853 tmpl_caps = gst_static_caps_get (&templ->static_caps); (gdb) l 854 855 /* FIXME, intersect is not the right method, we ideally want to check 856 * for a subset here */ 857 858 /* check if the intersection is empty */ 859 if ((subsetonly && gst_caps_is_subset (caps, tmpl_caps)) || 860 (!subsetonly && gst_caps_can_intersect (caps, tmpl_caps))) { 861 /* non empty intersection, we can use this element */ 862 g_queue_push_tail (&results, gst_object_ref (factory)); backtrace gst 1.0: Breakpoint 3, gst_element_factory_list_filter (list=0x89fc40 = {...}, caps=0x7fffe401bb20, direction=GST_PAD_SINK, subsetonly=1) at gstelementfactory.c:844 844 templates = gst_element_factory_get_static_pad_templates (factory); (gdb) p *factory $4 = {parent = {object = {object = {g_type_instance = {g_class = 0x6102a0}, ref_count = 6, qdata = 0x0}, lock = {p = 0x6c99b0, i = {7117232, 0}}, name = 0x6c99e0 "avdec_flv", parent = 0x61b070, flags = 0, control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, loaded = 0, rank = 64, plugin_name = 0x683410 "libav", plugin = 0x67b810, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}, type = 0, metadata = 0x6ca9a0, staticpadtemplates = 0x6caa00 = {0x6c9240, 0x6c9280}, numpadtemplates = 2, uri_type = GST_URI_UNKNOWN, uri_protocols = 0x0, interfaces = 0x0, _gst_reserved = {0x0, 0x0, 0x0, 0x0}} (gdb) p g_quark_to_string(((((GstCapsArrayElement *)((GstCapsImpl *)tmpl_caps)->array.data)[0]).structure).name) $20 = (const gchar *) 0x7fffe4004cbd "video/x-flash-video" (gdb) p g_quark_to_string(((((GstCapsArrayElement *)((GstCapsImpl *)caps)->array.data)[0]).structure).name) $21 = (const gchar *) 0x64d067 "video/x-flv" (gdb) p gst_structure_n_fields(((((GstCapsArrayElement *)((GstCapsImpl *)tmpl_caps)->array.data)[0]).structure))$22 = 1 (gdb) p gst_structure_n_fields(((((GstCapsArrayElement *)((GstCapsImpl *)caps)->array.data)[0]).structure)) $23 = 0 (gdb) p g_quark_to_string(((GstStructureField *)((GstStructureImpl *)((((GstCapsArrayElement *)((GstCapsImpl *)tmpl_caps)->array.data)[0]).structure))->fields->data)[0].name) $24 = (const gchar *) 0x7fffe4004cd1 "flvversion"
+ Trace 232145
commit 97015d3c93e26f6e5522fbd70b3f26d300cb71ef Author: Alban Browaeys <prahal@yahoo.com> Date: Tue Jun 25 21:16:38 2013 +0200 flvdemux: Add flvversion 1 to the flash-video caps This allows using avdec_flv which requires this field to be present in the caps. FLV only supports flash-video version 1 right now. https://bugzilla.gnome.org/show_bug.cgi?id=703076
Cherry-picked this into 1.0 as well.