mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-13 01:35:30 +00:00
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:
parent
1015073dfe
commit
081a3b4844
5 changed files with 30 additions and 9 deletions
15
ChangeLog
15
ChangeLog
|
@ -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>
|
2004-09-16 Iain <iaingnome@gmail.com>
|
||||||
|
|
||||||
* ext/ffmpeg/gstffmpegmux.c (gst_ffmpegmux_register): Free name fix
|
* ext/ffmpeg/gstffmpegmux.c (gst_ffmpegmux_register): Free name fix
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 5ec931d243c53ddda5b2cbb9a2c21ce89747bcb4
|
Subproject commit ded6dc5186cb7f8c64cb06a8591b9f787122c6f1
|
|
@ -295,7 +295,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||||
do {
|
do {
|
||||||
gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2;
|
gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2;
|
||||||
|
|
||||||
if (context)
|
if (context && context->extradata_size)
|
||||||
{
|
{
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||||
do {
|
do {
|
||||||
gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2;
|
gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2;
|
||||||
|
|
||||||
if (context)
|
if (context && context->extradata_size)
|
||||||
{
|
{
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
|
||||||
|
@ -355,9 +355,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||||
"codec_data", GST_TYPE_BUFFER, buffer,
|
"codec_data", GST_TYPE_BUFFER, buffer,
|
||||||
"block_align", G_TYPE_INT, context->block_align,
|
"block_align", G_TYPE_INT, context->block_align,
|
||||||
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
|
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
|
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
|
||||||
"wmaversion", G_TYPE_INT, version,
|
"wmaversion", G_TYPE_INT, version,
|
||||||
"block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
|
"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_WMAV1:
|
||||||
case CODEC_ID_WMAV2:
|
case CODEC_ID_WMAV2:
|
||||||
|
case CODEC_ID_WMV1:
|
||||||
|
case CODEC_ID_WMV2:
|
||||||
do {
|
do {
|
||||||
const GValue *value;
|
const GValue *value;
|
||||||
const GstBuffer *buf;
|
const GstBuffer *buf;
|
||||||
|
|
|
@ -219,6 +219,7 @@ gst_ffmpegdec_close (GstFFMpegDec *ffmpegdec)
|
||||||
if (!ffmpegdec->opened)
|
if (!ffmpegdec->opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ffmpegdec->context->priv_data)
|
||||||
avcodec_close (ffmpegdec->context);
|
avcodec_close (ffmpegdec->context);
|
||||||
ffmpegdec->opened = FALSE;
|
ffmpegdec->opened = FALSE;
|
||||||
|
|
||||||
|
@ -294,6 +295,9 @@ gst_ffmpegdec_connect (GstPad * pad, const GstCaps * caps)
|
||||||
/* do *not* draw edges */
|
/* do *not* draw edges */
|
||||||
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
|
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,
|
/* open codec - we don't select an output pix_fmt yet,
|
||||||
* simply because we don't know! We only get it
|
* simply because we don't know! We only get it
|
||||||
* during playback... */
|
* during playback... */
|
||||||
|
@ -395,9 +399,11 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data)
|
||||||
data = GST_BUFFER_DATA (inbuf);
|
data = GST_BUFFER_DATA (inbuf);
|
||||||
size = GST_BUFFER_SIZE (inbuf);
|
size = GST_BUFFER_SIZE (inbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = avcodec_decode_video (ffmpegdec->context,
|
len = avcodec_decode_video (ffmpegdec->context,
|
||||||
ffmpegdec->picture, &have_data, data, size);
|
ffmpegdec->picture, &have_data, data, size);
|
||||||
if (have_data) {
|
|
||||||
|
if (len >= 0 && have_data) {
|
||||||
/* libavcodec constantly crashes on stupid buffer allocation
|
/* libavcodec constantly crashes on stupid buffer allocation
|
||||||
* errors inside. This drives me crazy, so we let it allocate
|
* errors inside. This drives me crazy, so we let it allocate
|
||||||
* it's own buffers and copy to our own buffer afterwards... */
|
* it's own buffers and copy to our own buffer afterwards... */
|
||||||
|
|
|
@ -573,7 +573,7 @@ gst_ffmpegdemux_loop (GstElement * element)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read a package */
|
/* read a package */
|
||||||
res = av_read_packet (demux->context, &pkt);
|
res = av_read_frame (demux->context, &pkt);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
#if 0
|
#if 0
|
||||||
/* This doesn't work - FIXME */
|
/* This doesn't work - FIXME */
|
||||||
|
|
Loading…
Reference in a new issue