From 595217e8401de7015886204e1ca4e2cfc06235f6 Mon Sep 17 00:00:00 2001 From: Jens Granseuer Date: Sat, 9 Dec 2006 15:12:38 +0000 Subject: [PATCH] Declare variables at the beginning of a block. Fixes #383195. Original commit message from CVS: Patch by: Jens Granseuer * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_create): * gst-libs/gst/rtp/gstbasertpaudiopayload.c: (gst_base_rtp_audio_payload_handle_frame_based_buffer), (gst_base_rtp_audio_payload_handle_sample_based_buffer): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_fixate): Declare variables at the beginning of a block. Fixes #383195. --- ChangeLog | 11 +++++++++++ gst-libs/gst/cdda/gstcddabasesrc.c | 4 ++-- gst-libs/gst/rtp/gstbasertpaudiopayload.c | 10 +++++++--- sys/v4l/gstv4lsrc.c | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb6f573fe1..8d2fee9c0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-12-09 Tim-Philipp Müller + + Patch by: Jens Granseuer + + * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_create): + * gst-libs/gst/rtp/gstbasertpaudiopayload.c: + (gst_base_rtp_audio_payload_handle_frame_based_buffer), + (gst_base_rtp_audio_payload_handle_sample_based_buffer): + * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_fixate): + Declare variables at the beginning of a block. Fixes #383195. + 2006-12-07 Jan Schmidt * configure.ac: diff --git a/gst-libs/gst/cdda/gstcddabasesrc.c b/gst-libs/gst/cdda/gstcddabasesrc.c index adc0c29a6f..661559e4a8 100644 --- a/gst-libs/gst/cdda/gstcddabasesrc.c +++ b/gst-libs/gst/cdda/gstcddabasesrc.c @@ -1548,10 +1548,10 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer) format = GST_FORMAT_TIME; if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &qry_position)) { - position = (GstClockTime) qry_position; - gint64 next_ts = 0; + position = (GstClockTime) qry_position; + ++src->cur_sector; if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &next_ts)) { duration = (GstClockTime) (next_ts - qry_position); diff --git a/gst-libs/gst/rtp/gstbasertpaudiopayload.c b/gst-libs/gst/rtp/gstbasertpaudiopayload.c index ce7fad81c3..9408dbfd37 100644 --- a/gst-libs/gst/rtp/gstbasertpaudiopayload.c +++ b/gst-libs/gst/rtp/gstbasertpaudiopayload.c @@ -322,6 +322,8 @@ gst_base_rtp_audio_payload_handle_frame_based_buffer (GstBaseRTPPayload * /* as long as we have full frames */ /* this loop will push all available buffers till the last frame */ while (available >= frame_size) { + gfloat ts_inc; + /* we need to see how many frames we can get based on maximum MTU, maximum * ptime and the number of bytes available */ payload_len = MIN (MIN ( @@ -336,7 +338,7 @@ gst_base_rtp_audio_payload_handle_frame_based_buffer (GstBaseRTPPayload * ret = gst_base_rtp_audio_payload_push (basepayload, data, payload_len, basertpaudiopayload->base_ts); - gfloat ts_inc = (payload_len * frame_duration) / frame_size; + ts_inc = (payload_len * frame_duration) / frame_size; ts_inc = ts_inc * GST_MSECOND; basertpaudiopayload->base_ts += ts_inc; @@ -414,6 +416,8 @@ gst_base_rtp_audio_payload_handle_sample_based_buffer (GstBaseRTPPayload * /* as long as we have full frames */ /* this loop will use all available data until the last byte */ while (available) { + gfloat num, datarate; + /* we need to see how many frames we can get based on maximum MTU, maximum * ptime and the number of bytes available */ payload_len = MIN (MIN ( @@ -428,8 +432,8 @@ gst_base_rtp_audio_payload_handle_sample_based_buffer (GstBaseRTPPayload * ret = gst_base_rtp_audio_payload_push (basepayload, data, payload_len, basertpaudiopayload->base_ts); - gfloat num = payload_len; - gfloat datarate = (sample_size * basepayload->clock_rate); + num = payload_len; + datarate = (sample_size * basepayload->clock_rate); basertpaudiopayload->base_ts += /* payload_len (bytes) * nsecs/sec / datarate (bytes*sec) */ diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index 564edb48ad..8422ee188b 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -231,9 +231,9 @@ gst_v4lsrc_fixate (GstPad * pad, GstCaps * caps) GST_DEBUG_OBJECT (v4lsrc, "targetting %dx%d", targetwidth, targetheight); for (i = 0; i < gst_caps_get_size (caps); ++i) { - structure = gst_caps_get_structure (caps, i); const GValue *v; + structure = gst_caps_get_structure (caps, i); gst_structure_fixate_field_nearest_int (structure, "width", targetwidth); gst_structure_fixate_field_nearest_int (structure, "height", targetheight); gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2);