gst-libs/gst/riff/riff-read.c: Additional pad usability check.

Original commit message from CVS:
2004-01-25  Ronald Bultje  <rbultje@ronald.bitfreak.net>

* gst-libs/gst/riff/riff-read.c: (gst_riff_read_info):
Additional pad usability check.
* gst/mpeg1videoparse/gstmp1videoparse.c: (gst_mp1videoparse_init),
(mp1videoparse_find_next_gop), (gst_mp1videoparse_time_code),
(gst_mp1videoparse_real_chain):
Fix MPEG video stream parsing. The original plugin had several
issues, including not timestamping streams where the source was
not timestamped (this happens with PTS values in mpeg system
streams, but MPEG video is also a valid stream on its own so
that needs timestamps too). We use the display time code for that
for now. Also, if one incoming buffer contains multiple valid
frames, we push them all on correctly now, including proper EOS
handling. Lastly, several potential segfaults were fixed, and we
properly sync on new sequence/gop headers to include them in next,
not previous frames (since they're header for the next frame, not
the previous). Also see #119206.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain),
(bpf_from_header):
Move caps setting so we only do it after finding several valid
MPEG-1 fraes sequentially, not right after the first one (which
might be coincidental).
* gst/typefind/gsttypefindfunctions.c: (mpeg1_sys_type_find),
(mpeg_video_type_find), (mpeg_video_stream_type_find),
(plugin_init):
Add unsynced MPEG video stream typefinding, and change some
probability values so we detect streams rightly. The idea is as
follows: I can have an unsynced system stream which contains
video. In the current code, I would randomly get a type for either
system or video stream type found, because the probabilities are
being calculated rather randomly. I now use fixed values, so we
always prefer system stream if that was found (and that is how it
should be). If no system stream was found, we can still identity
the stream as video-only.
This commit is contained in:
Ronald S. Bultje 2004-01-25 00:25:16 +00:00
parent a0183b2c75
commit ac4a225d2b
3 changed files with 56 additions and 15 deletions

View file

@ -1,3 +1,38 @@
2004-01-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_info):
Additional pad usability check.
* gst/mpeg1videoparse/gstmp1videoparse.c: (gst_mp1videoparse_init),
(mp1videoparse_find_next_gop), (gst_mp1videoparse_time_code),
(gst_mp1videoparse_real_chain):
Fix MPEG video stream parsing. The original plugin had several
issues, including not timestamping streams where the source was
not timestamped (this happens with PTS values in mpeg system
streams, but MPEG video is also a valid stream on its own so
that needs timestamps too). We use the display time code for that
for now. Also, if one incoming buffer contains multiple valid
frames, we push them all on correctly now, including proper EOS
handling. Lastly, several potential segfaults were fixed, and we
properly sync on new sequence/gop headers to include them in next,
not previous frames (since they're header for the next frame, not
the previous). Also see #119206.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain),
(bpf_from_header):
Move caps setting so we only do it after finding several valid
MPEG-1 fraes sequentially, not right after the first one (which
might be coincidental).
* gst/typefind/gsttypefindfunctions.c: (mpeg1_sys_type_find),
(mpeg_video_type_find), (mpeg_video_stream_type_find),
(plugin_init):
Add unsynced MPEG video stream typefinding, and change some
probability values so we detect streams rightly. The idea is as
follows: I can have an unsynced system stream which contains
video. In the current code, I would randomly get a type for either
system or video stream type found, because the probabilities are
being calculated rather randomly. I now use fixed values, so we
always prefer system stream if that was found (and that is how it
should be). If no system stream was found, we can still identity the stream as video-only.
2004-01-23 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/avi/gstavidemux.c: (gst_avi_demux_stream_avih),

View file

@ -815,7 +815,7 @@ gst_riff_read_info (GstRiffRead *riff)
/* let the world know about this wonderful thing */
for (padlist = gst_element_get_pad_list (element);
padlist != NULL; padlist = padlist->next) {
if (GST_PAD_IS_SRC (padlist->data)) {
if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE(padlist->data)) {
gst_event_ref (event);
gst_pad_push (GST_PAD (padlist->data), GST_DATA (event));
}

View file

@ -402,6 +402,26 @@ gst_mp3parse_chain (GstPad *pad, GstData *_data)
GST_DEBUG ("mp3parse: partial buffer needed %ld < %d ",(size-offset), bpf);
break;
} else {
guint bitrate, layer, rate, channels;
if (!mp3_type_frame_length_from_header (header, &layer,
&channels,
&bitrate, &rate)) {
g_error("Header failed internal error");
}
if (channels != mp3parse->channels ||
rate != mp3parse->rate ||
layer != mp3parse->layer ||
bitrate != mp3parse->bit_rate) {
GstCaps *caps = mp3_caps_create (layer, channels, bitrate, rate);
gst_pad_set_explicit_caps(mp3parse->srcpad, caps);
mp3parse->channels = channels;
mp3parse->layer = layer;
mp3parse->rate = rate;
mp3parse->bit_rate = bitrate;
}
outbuf = gst_buffer_create_sub(mp3parse->partialbuf,offset,bpf);
@ -460,20 +480,6 @@ bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
return 0;
}
if (channels != parse->channels ||
rate != parse->rate ||
layer != parse->layer ||
bitrate != parse->bit_rate) {
GstCaps *caps = mp3_caps_create (layer, channels, bitrate, rate);
gst_pad_set_explicit_caps(parse->srcpad, caps);
parse->channels = channels;
parse->layer = layer;
parse->rate = rate;
parse->bit_rate = bitrate;
}
return length;
}