ext/ffmpeg/gstffmpegcodecmap.c: WMV extradata (make #152798 work). J-frames are only available in the bitstream if th...

Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_with_codecid):
WMV extradata (make #152798 work). J-frames are only available
in the bitstream if the J-frame bit has been set in the extradata.
If not (or if extradata is not provided), the movie won't play.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_connect), (gst_ffmpegdec_chain):
Only close ffmpeg if privdata was allocated (else it segfaults).
Autodetect encoding bugs and workaround it. Don't copy data if
decoding failed.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop):
Use read_frame() instead of read_packet() which is obsolete.
This commit is contained in:
Ronald S. Bultje 2004-09-20 12:29:03 +00:00
parent 1015073dfe
commit 081a3b4844
5 changed files with 30 additions and 9 deletions

View file

@ -1,3 +1,18 @@
2004-09-20 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_with_codecid):
WMV extradata (make #152798 work). J-frames are only available
in the bitstream if the J-frame bit has been set in the extradata.
If not (or if extradata is not provided), the movie won't play.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_connect), (gst_ffmpegdec_chain):
Only close ffmpeg if privdata was allocated (else it segfaults).
Autodetect encoding bugs and workaround it. Don't copy data if
decoding failed.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop):
Use read_frame() instead of read_packet() which is obsolete.
2004-09-16 Iain <iaingnome@gmail.com>
* ext/ffmpeg/gstffmpegmux.c (gst_ffmpegmux_register): Free name fix

2
common

@ -1 +1 @@
Subproject commit 5ec931d243c53ddda5b2cbb9a2c21ce89747bcb4
Subproject commit ded6dc5186cb7f8c64cb06a8591b9f787122c6f1

View file

@ -295,7 +295,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
do {
gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2;
if (context)
if (context && context->extradata_size)
{
GstBuffer *buffer;
@ -343,7 +343,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
do {
gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2;
if (context)
if (context && context->extradata_size)
{
GstBuffer *buffer;
@ -355,9 +355,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"codec_data", GST_TYPE_BUFFER, buffer,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
}
else
{
} else {
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
"wmaversion", G_TYPE_INT, version,
"block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
@ -1167,6 +1165,8 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
case CODEC_ID_WMAV1:
case CODEC_ID_WMAV2:
case CODEC_ID_WMV1:
case CODEC_ID_WMV2:
do {
const GValue *value;
const GstBuffer *buf;

View file

@ -219,7 +219,8 @@ gst_ffmpegdec_close (GstFFMpegDec *ffmpegdec)
if (!ffmpegdec->opened)
return;
avcodec_close (ffmpegdec->context);
if (ffmpegdec->context->priv_data)
avcodec_close (ffmpegdec->context);
ffmpegdec->opened = FALSE;
if (ffmpegdec->context->palctrl) {
@ -294,6 +295,9 @@ gst_ffmpegdec_connect (GstPad * pad, const GstCaps * caps)
/* do *not* draw edges */
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
/* workaround encoder bugs */
ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
/* open codec - we don't select an output pix_fmt yet,
* simply because we don't know! We only get it
* during playback... */
@ -395,9 +399,11 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data)
data = GST_BUFFER_DATA (inbuf);
size = GST_BUFFER_SIZE (inbuf);
}
len = avcodec_decode_video (ffmpegdec->context,
ffmpegdec->picture, &have_data, data, size);
if (have_data) {
if (len >= 0 && have_data) {
/* libavcodec constantly crashes on stupid buffer allocation
* errors inside. This drives me crazy, so we let it allocate
* it's own buffers and copy to our own buffer afterwards... */

View file

@ -573,7 +573,7 @@ gst_ffmpegdemux_loop (GstElement * element)
}
/* read a package */
res = av_read_packet (demux->context, &pkt);
res = av_read_frame (demux->context, &pkt);
if (res < 0) {
#if 0
/* This doesn't work - FIXME */