don't make function do two things

Original commit message from CVS:
don't make function do two things
This commit is contained in:
Thomas Vander Stichele 2004-07-26 13:30:28 +00:00
parent 17615126c2
commit 9d17d2d661
4 changed files with 23 additions and 14 deletions

View file

@ -1,3 +1,12 @@
2004-07-26 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pix_fmt):
* gst/ffmpegcolorspace/gstffmpegcodecmap.h:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcolorspace_pad_link):
don't make function do two things at the same time without reason.
2004-07-26 Steve Lhomme <steve.lhomme@free.fr>
* gst/ac3parse/ac3parse.vcproj

View file

@ -191,8 +191,7 @@ gst_ffmpeg_pix_fmt_to_caps (void)
*/
enum PixelFormat
gst_ffmpeg_caps_to_pix_fmt (const GstCaps * caps,
int *width, int *height, double *framerate)
gst_ffmpeg_caps_to_pix_fmt (const GstCaps * caps)
{
GstStructure *structure;
enum PixelFormat pix_fmt = PIX_FMT_NB;
@ -200,10 +199,6 @@ gst_ffmpeg_caps_to_pix_fmt (const GstCaps * caps,
g_return_val_if_fail (gst_caps_get_size (caps) == 1, PIX_FMT_NB);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "width", width);
gst_structure_get_int (structure, "height", height);
gst_structure_get_double (structure, "framerate", framerate);
if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) {
guint32 fourcc;

View file

@ -31,8 +31,6 @@ gst_ffmpeg_pix_fmt_to_caps (void);
/* Disect a GstCaps */
enum PixelFormat
gst_ffmpeg_caps_to_pix_fmt (const GstCaps *caps,
int *width, int *height,
double *fps);
gst_ffmpeg_caps_to_pix_fmt (const GstCaps *caps);
#endif /* __GST_FFMPEG_CODECMAP_H__ */

View file

@ -165,15 +165,22 @@ static GstPadLinkReturn
gst_ffmpegcolorspace_pad_link (GstPad * pad, const GstCaps * caps)
{
GstFFMpegColorspace *space;
GstStructure *structure;
const GstCaps *othercaps;
GstPad *otherpad;
GstPadLinkReturn ret;
enum PixelFormat pix_fmt;
int height, width;
double framerate;
enum PixelFormat pix_fmt;
space = GST_FFMPEGCOLORSPACE (gst_pad_get_parent (pad));
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
gst_structure_get_double (structure, "framerate", &framerate);
otherpad = (pad == space->srcpad) ? space->sinkpad : space->srcpad;
GST_DEBUG_OBJECT (space, "pad_link on %s:%s with caps %" GST_PTR_FORMAT,
@ -183,7 +190,7 @@ gst_ffmpegcolorspace_pad_link (GstPad * pad, const GstCaps * caps)
/* loop over all possibilities and select the first one we can convert and
* is accepted by the peer */
pix_fmt = gst_ffmpeg_caps_to_pix_fmt (caps, &width, &height, &framerate);
pix_fmt = gst_ffmpeg_caps_to_pix_fmt (caps);
if (pix_fmt == PIX_FMT_NB) {
/* we disable ourself here */
if (pad == space->srcpad) {
@ -199,13 +206,13 @@ gst_ffmpegcolorspace_pad_link (GstPad * pad, const GstCaps * caps)
/* set the size on the otherpad */
othercaps = gst_pad_get_negotiated_caps (otherpad);
if (othercaps) {
GstCaps *caps = gst_caps_copy (othercaps);
GstCaps *newothercaps = gst_caps_copy (othercaps);
gst_caps_set_simple (caps,
gst_caps_set_simple (newothercaps,
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height,
"framerate", G_TYPE_DOUBLE, framerate, NULL);
ret = gst_pad_try_set_caps (otherpad, caps);
ret = gst_pad_try_set_caps (otherpad, newothercaps);
if (GST_PAD_LINK_FAILED (ret)) {
return ret;
}