summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorEdgard Lima <edgard.lima@indt.org.br>2006-10-26 14:07:08 +0000
committerEdgard Lima <edgard.lima@indt.org.br>2006-10-26 14:07:08 +0000
commitdb8ec6cf87ca830a494dbb753f16a242ab1b5e5b (patch)
treea7e38db123ff0b977250794b085869078a770a02 /gst
parent0fbc246d234b70e14f94efe77226bbe976a2da1d (diff)
downloadgst-plugins-bad-db8ec6cf87ca830a494dbb753f16a242ab1b5e5b.tar.gz
gst-plugins-bad-db8ec6cf87ca830a494dbb753f16a242ab1b5e5b.tar.bz2
gst-plugins-bad-db8ec6cf87ca830a494dbb753f16a242ab1b5e5b.zip
Fixed bug for files with timestamps less than 0.
Original commit message from CVS: Fixed bug for files with timestamps less than 0.
Diffstat (limited to 'gst')
-rw-r--r--gst/nuvdemux/gstnuvdemux.c31
-rw-r--r--gst/nuvdemux/gstnuvdemux.h4
2 files changed, 25 insertions, 10 deletions
diff --git a/gst/nuvdemux/gstnuvdemux.c b/gst/nuvdemux/gstnuvdemux.c
index eb3aba56..768af1ee 100644
--- a/gst/nuvdemux/gstnuvdemux.c
+++ b/gst/nuvdemux/gstnuvdemux.c
@@ -329,7 +329,7 @@ gst_nuv_demux_frame_header_load (GstNuvDemux * nuv, nuv_frame_header ** h_ret)
h->i_timecode = GST_READ_UINT32_LE (&data[4]);
h->i_length = GST_READ_UINT32_LE (&data[8]);
- GST_DEBUG_OBJECT (nuv, "frame hdr: t=%c c=%c k=%d f=0x%x timecode=%u l=%u",
+ GST_DEBUG_OBJECT (nuv, "frame hdr: t=%c c=%c k=%d f=0x%x timecode=%d l=%d",
h->i_type,
h->i_compression ? h->i_compression : ' ',
h->i_keyframe ? h->i_keyframe : ' ',
@@ -426,6 +426,7 @@ gst_nuv_demux_create_pads (GstNuvDemux * nuv)
gst_nuv_demux_handle_src_event);
gst_pad_set_active (nuv->src_video_pad, TRUE);
gst_element_add_pad (GST_ELEMENT (nuv), nuv->src_video_pad);
+
gst_caps_unref (video_caps);
}
@@ -449,6 +450,7 @@ gst_nuv_demux_create_pads (GstNuvDemux * nuv)
gst_pad_set_event_function (nuv->src_audio_pad,
gst_nuv_demux_handle_src_event);
+
gst_caps_unref (audio_caps);
}
@@ -478,16 +480,22 @@ gst_nuv_demux_stream_data (GstNuvDemux * nuv)
if (h->i_type == 'R')
goto done;
- ret = gst_nuv_demux_read_bytes (nuv, h->i_length, TRUE, &buf);
- if (ret != GST_FLOW_OK) {
- return ret;
+ if (h->i_length > 0) {
+ ret = gst_nuv_demux_read_bytes (nuv, h->i_length, TRUE, &buf);
+ if (ret != GST_FLOW_OK)
+ return ret;
+
+ if (h->i_timecode > 0)
+ GST_BUFFER_TIMESTAMP (buf) = h->i_timecode * GST_MSECOND;
}
- GST_BUFFER_TIMESTAMP (buf) = h->i_timecode * GST_MSECOND;
switch (h->i_type) {
case 'V':
{
+ if (h->i_length == 0)
+ break;
+
GST_BUFFER_OFFSET (buf) = nuv->video_offset;
gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_video_pad));
ret = gst_pad_push (nuv->src_video_pad, buf);
@@ -496,6 +504,9 @@ gst_nuv_demux_stream_data (GstNuvDemux * nuv)
}
case 'A':
{
+ if (h->i_length == 0)
+ break;
+
GST_BUFFER_OFFSET (buf) = nuv->audio_offset;
gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_audio_pad));
ret = gst_pad_push (nuv->src_audio_pad, buf);
@@ -507,18 +518,22 @@ gst_nuv_demux_stream_data (GstNuvDemux * nuv)
switch (h->i_compression) {
case 'V':
gst_pad_push_event (nuv->src_video_pad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
+ gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1,
+ h->i_timecode));
break;
case 'A':
gst_pad_push_event (nuv->src_audio_pad,
gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
-
break;
default:
break;
}
- break;
}
+ default:
+ if (buf != NULL)
+ gst_buffer_unref (buf);
+
+ break;
}
done:
diff --git a/gst/nuvdemux/gstnuvdemux.h b/gst/nuvdemux/gstnuvdemux.h
index 56da9ef8..24fdd6d4 100644
--- a/gst/nuvdemux/gstnuvdemux.h
+++ b/gst/nuvdemux/gstnuvdemux.h
@@ -92,9 +92,9 @@ typedef struct
0x02: gauss 5 pixel (8,1,1,1,1)/12
0x04: cartoon filter */
- guint32 i_timecode; /* ms */
+ gint i_timecode; /* ms */
- guint32 i_length; /* V,A,T: length of following data
+ gint i_length; /* V,A,T: length of following data
S: length of packet correl */
} nuv_frame_header;