mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 14:02:26 +00:00
qtmux: add variant-less video/quicktime to source pad template caps
This is needed for automatic transcoding using encodebin. Our typefinder does not always add a variant to the found caps, and encodebin needs an *exact* match to the caps on the source pad template, so we need to add the variant-less video/quicktime caps to the template as well for encodebin to be able to find it. Add unit test for this as well. https://bugzilla.gnome.org/show_bug.cgi?id=642879
This commit is contained in:
parent
18eee7719d
commit
025417f124
4 changed files with 83 additions and 19 deletions
|
@ -1591,6 +1591,9 @@ gst_qt_mux_start_file (GstQTMux * qtmux)
|
||||||
GST_DEBUG_OBJECT (qtmux, "starting file");
|
GST_DEBUG_OBJECT (qtmux, "starting file");
|
||||||
|
|
||||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (qtmux->srcpad));
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (qtmux->srcpad));
|
||||||
|
/* qtmux has structure with and without variant, remove all but the first */
|
||||||
|
while (gst_caps_get_size (caps) > 1)
|
||||||
|
gst_caps_remove_structure (caps, 1);
|
||||||
gst_pad_set_caps (qtmux->srcpad, caps);
|
gst_pad_set_caps (qtmux->srcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,8 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = {
|
||||||
"qtmux",
|
"qtmux",
|
||||||
"QuickTime",
|
"QuickTime",
|
||||||
"GstQTMux",
|
"GstQTMux",
|
||||||
GST_STATIC_CAPS ("video/quicktime, variant = (string) apple"),
|
GST_STATIC_CAPS ("video/quicktime, variant = (string) apple; "
|
||||||
|
"video/quicktime"),
|
||||||
GST_STATIC_CAPS ("video/x-raw-rgb, "
|
GST_STATIC_CAPS ("video/x-raw-rgb, "
|
||||||
COMMON_VIDEO_CAPS "; "
|
COMMON_VIDEO_CAPS "; "
|
||||||
"video/x-raw-yuv, "
|
"video/x-raw-yuv, "
|
||||||
|
|
|
@ -235,11 +235,15 @@ elements_level_LDADD = $(LDADD) $(LIBM)
|
||||||
|
|
||||||
elements_matroskamux_LDADD = $(GST_BASE_LIBS) $(LDADD) $(LIBM)
|
elements_matroskamux_LDADD = $(GST_BASE_LIBS) $(LDADD) $(LIBM)
|
||||||
|
|
||||||
|
elements_qtmux_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
|
||||||
|
elements_qtmux_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstpbutils-@GST_MAJORMINOR@ \
|
||||||
|
$(GST_BASE_LIBS) $(GST_LIBS) $(GST_CHECK_LIBS)
|
||||||
|
|
||||||
elements_rtpbin_buffer_list_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
|
elements_rtpbin_buffer_list_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
|
||||||
$(WARNING_CFLAGS) $(ERROR_CFLAGS) $(GST_CHECK_CFLAGS) $(AM_CFLAGS)
|
$(WARNING_CFLAGS) $(ERROR_CFLAGS) $(GST_CHECK_CFLAGS) $(AM_CFLAGS)
|
||||||
elements_rtpbin_buffer_list_LDADD = $(GST_PLUGINS_BASE_LIBS) \
|
elements_rtpbin_buffer_list_LDADD = $(GST_PLUGINS_BASE_LIBS) \
|
||||||
-lgstnetbuffer-@GST_MAJORMINOR@ -lgstrtp-@GST_MAJORMINOR@ \
|
-lgstnetbuffer-@GST_MAJORMINOR@ -lgstrtp-@GST_MAJORMINOR@ \
|
||||||
$(GST_BASE_LIBS) $(GST_LIBS_LIBS) $(GST_CHECK_LIBS)
|
$(GST_BASE_LIBS) $(GST_LIBS) $(GST_CHECK_LIBS)
|
||||||
elements_rtpbin_buffer_list_SOURCES = elements/rtpbin_buffer_list.c
|
elements_rtpbin_buffer_list_SOURCES = elements/rtpbin_buffer_list.c
|
||||||
|
|
||||||
elements_souphttpsrc_CFLAGS = $(SOUP_CFLAGS) $(AM_CFLAGS)
|
elements_souphttpsrc_CFLAGS = $(SOUP_CFLAGS) $(AM_CFLAGS)
|
||||||
|
|
|
@ -20,9 +20,16 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/pbutils/encoding-profile.h>
|
||||||
|
|
||||||
/* For ease of programming we use globals to keep refs for our floating
|
/* For ease of programming we use globals to keep refs for our floating
|
||||||
* src and sink pads we create; otherwise we always have to do get_pad,
|
* src and sink pads we create; otherwise we always have to do get_pad,
|
||||||
|
@ -385,6 +392,70 @@ GST_START_TEST (test_reuse)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
static GstEncodingContainerProfile *
|
||||||
|
create_qtmux_profile (const gchar * variant)
|
||||||
|
{
|
||||||
|
GstEncodingContainerProfile *cprof;
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
if (variant == NULL) {
|
||||||
|
caps = gst_caps_new_simple ("video/quicktime", NULL);
|
||||||
|
} else {
|
||||||
|
caps = gst_caps_new_simple ("video/quicktime",
|
||||||
|
"variant", G_TYPE_STRING, variant, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
cprof = gst_encoding_container_profile_new ("Name", "blah", caps, NULL);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
caps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 16,
|
||||||
|
"depth", G_TYPE_INT, 16, "endianness", G_TYPE_INT, 4321,
|
||||||
|
"channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 44100,
|
||||||
|
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
|
gst_encoding_container_profile_add_profile (cprof,
|
||||||
|
GST_ENCODING_PROFILE (gst_encoding_audio_profile_new (caps, NULL, NULL,
|
||||||
|
1)));
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
return cprof;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_START_TEST (test_encodebin)
|
||||||
|
{
|
||||||
|
GstEncodingContainerProfile *cprof;
|
||||||
|
GstElement *enc;
|
||||||
|
GstPad *pad;
|
||||||
|
|
||||||
|
enc = gst_element_factory_make ("encodebin", NULL);
|
||||||
|
if (enc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Make sure encodebin finds a muxer for a profile with a variant field .. */
|
||||||
|
cprof = create_qtmux_profile ("apple");
|
||||||
|
g_object_set (enc, "profile", cprof, NULL);
|
||||||
|
gst_encoding_profile_unref (cprof);
|
||||||
|
|
||||||
|
/* should have created a pad after setting the profile */
|
||||||
|
pad = gst_element_get_static_pad (enc, "audio_0");
|
||||||
|
fail_unless (pad != NULL);
|
||||||
|
gst_object_unref (pad);
|
||||||
|
gst_object_unref (enc);
|
||||||
|
|
||||||
|
/* ... and for a profile without a variant field */
|
||||||
|
enc = gst_element_factory_make ("encodebin", NULL);
|
||||||
|
cprof = create_qtmux_profile (NULL);
|
||||||
|
g_object_set (enc, "profile", cprof, NULL);
|
||||||
|
gst_encoding_profile_unref (cprof);
|
||||||
|
|
||||||
|
/* should have created a pad after setting the profile */
|
||||||
|
pad = gst_element_get_static_pad (enc, "audio_0");
|
||||||
|
fail_unless (pad != NULL);
|
||||||
|
gst_object_unref (pad);
|
||||||
|
gst_object_unref (enc);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
qtmux_suite (void)
|
qtmux_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -398,25 +469,10 @@ qtmux_suite (void)
|
||||||
tcase_add_test (tc_chain, test_audio_pad_frag);
|
tcase_add_test (tc_chain, test_audio_pad_frag);
|
||||||
tcase_add_test (tc_chain, test_video_pad_frag_streamable);
|
tcase_add_test (tc_chain, test_video_pad_frag_streamable);
|
||||||
tcase_add_test (tc_chain, test_audio_pad_frag_streamable);
|
tcase_add_test (tc_chain, test_audio_pad_frag_streamable);
|
||||||
|
|
||||||
tcase_add_test (tc_chain, test_reuse);
|
tcase_add_test (tc_chain, test_reuse);
|
||||||
|
tcase_add_test (tc_chain, test_encodebin);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
GST_CHECK_MAIN (qtmux)
|
||||||
main (int argc, char **argv)
|
|
||||||
{
|
|
||||||
int nf;
|
|
||||||
|
|
||||||
Suite *s = qtmux_suite ();
|
|
||||||
SRunner *sr = srunner_create (s);
|
|
||||||
|
|
||||||
gst_check_init (&argc, &argv);
|
|
||||||
|
|
||||||
srunner_run_all (sr, CK_NORMAL);
|
|
||||||
nf = srunner_ntests_failed (sr);
|
|
||||||
srunner_free (sr);
|
|
||||||
|
|
||||||
return nf;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue