From e9d760851b7902d955720288b8cc300e07f37d2c Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 7 May 2004 16:17:25 +0000 Subject: [PATCH] ext/dv/gstdvdec.c: Fix caps nego and pad templates. RGB mode caps should work now. Original commit message from CVS: * ext/dv/gstdvdec.c: (gst_dvdec_video_link): Fix caps nego and pad templates. RGB mode caps should work now. * ext/dvdnav/gst-dvd: Move mpeg2dec inside the thread because otherwise the queue rejects cap changes mid-stream * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_get_type), (gst_mpeg2dec_flush_decoder): For mpeg2dec > 0.4.0, call the flush function instead of manually extracting all in-flight frames. * ext/raw1394/gstdv1394src.c: (gst_dv1394src_factory), (gst_dv1394src_init), (gst_dv1394src_iso_receive): Change mime type video/dv go video/x-dv to match the rest of gst-plugins --- ChangeLog | 16 ++++++++++++++++ ext/dv/gstdvdec.c | 17 +++++++++-------- ext/raw1394/gstdv1394src.c | 15 ++++++++------- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab7a05c6b1..8b7fd9edfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-05-08 Jan Schmidt + * ext/dv/gstdvdec.c: (gst_dvdec_video_link): + Fix caps nego and pad templates. RGB mode caps should + work now. + * ext/dvdnav/gst-dvd: + Move mpeg2dec inside the thread because otherwise the + queue rejects cap changes mid-stream + * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_get_type), + (gst_mpeg2dec_flush_decoder): + For mpeg2dec > 0.4.0, call the flush function instead of + manually extracting all in-flight frames. + * ext/raw1394/gstdv1394src.c: (gst_dv1394src_factory), + (gst_dv1394src_init), (gst_dv1394src_iso_receive): + Change mime type video/dv go video/x-dv to match the + rest of gst-plugins + 2004-05-07 Ronald Bultje * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_build_list): diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index fc5f1626f5..2ce3a47935 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -93,9 +93,9 @@ static GstStaticPadTemplate video_src_temp = GST_STATIC_PAD_TEMPLATE ("video", "bpp = (int) 32, " "depth = (int) 32, " "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " - "red_mask = (int) 0x000000ff, " + "red_mask = (int) 0x00ff0000, " "green_mask = (int) 0x0000ff00, " - "blue_mask = (int) 0x00ff0000, " + "blue_mask = (int) 0x000000ff, " "width = (int) 720, " "height = (int) { " G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) @@ -107,9 +107,9 @@ static GstStaticPadTemplate video_src_temp = GST_STATIC_PAD_TEMPLATE ("video", "bpp = (int) 24, " "depth = (int) 24, " "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " - "red_mask = (int) 0x000000ff, " + "red_mask = (int) 0x00ff0000, " "green_mask = (int) 0x0000ff00, " - "blue_mask = (int) 0x00ff0000, " + "blue_mask = (int) 0x000000ff, " "width = (int) 720, " "height = (int) { " G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) @@ -712,16 +712,14 @@ gst_dvdec_video_link (GstPad * pad, const GstCaps * caps) structure = gst_caps_get_structure (caps, 0); - /* it worked, try to find what it was again */ - if (!gst_structure_get_fourcc (structure, "format", &fourcc) || - !gst_structure_get_int (structure, "height", &height) || + if (!gst_structure_get_int (structure, "height", &height) || !gst_structure_get_double (structure, "framerate", &framerate)) return GST_PAD_LINK_REFUSED; if ((height != dvdec->height) || (framerate != dvdec->framerate)) return GST_PAD_LINK_REFUSED; - if (fourcc == GST_STR_FOURCC ("RGB ")) { + if (strcmp (gst_structure_get_name (structure), "video/x-raw-rgb") == 0) { gint bpp; gst_structure_get_int (structure, "bpp", &bpp); @@ -733,6 +731,9 @@ gst_dvdec_video_link (GstPad * pad, const GstCaps * caps) dvdec->bpp = 4; } } else { + if (!gst_structure_get_fourcc (structure, "format", &fourcc)) + return GST_PAD_LINK_REFUSED; + dvdec->space = e_dv_color_yuv; dvdec->bpp = 2; } diff --git a/ext/raw1394/gstdv1394src.c b/ext/raw1394/gstdv1394src.c index fcc937291b..be9de56e3b 100644 --- a/ext/raw1394/gstdv1394src.c +++ b/ext/raw1394/gstdv1394src.c @@ -63,7 +63,7 @@ gst_dv1394src_factory (void) GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("dv1394src", - "video/dv", + "video/x-dv", gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"), G_TYPE_STRING ("PAL") ), NULL) @@ -156,6 +156,7 @@ gst_dv1394src_init (GstDV1394Src * dv1394src) { dv1394src->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_get_function (dv1394src->srcpad, gst_dv1394src_get); + gst_pad_use_explicit_caps (dv1394src->srcpad); gst_element_add_pad (GST_ELEMENT (dv1394src), dv1394src->srcpad); dv1394src->card = 0; @@ -252,9 +253,9 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len, // PAL dv1394src->frameSize = PAL_FRAMESIZE; GST_DEBUG ("PAL data"); - if (gst_pad_try_set_caps (dv1394src->srcpad, - gst_caps_new_simple ("video/dv", - "format", G_TYPE_STRING, "PAL", NULL)) <= 0) { + if (!gst_pad_set_explicit_caps (dv1394src->srcpad, + gst_caps_new_simple ("video/x-dv", + "format", G_TYPE_STRING, "PAL", NULL))) { GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL), ("Could not set source caps for PAL")); return 0; @@ -264,9 +265,9 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len, dv1394src->frameSize = NTSC_FRAMESIZE; GST_DEBUG ("NTSC data [untested] - please report success/failure to "); - if (gst_pad_try_set_caps (dv1394src->srcpad, - gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING, - "NTSC", NULL)) <= 0) { + if (!gst_pad_set_explicit_caps (dv1394src->srcpad, + gst_caps_new_simple ("video/x-dv", "format", G_TYPE_STRING, + "NTSC", NULL))) { GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL), ("Could not set source caps for NTSC")); return 0;