ext/ffmpeg/gstffmpegenc.c: Remove EMU_EDGE, since that really fixes #162905. Revert previous hacks.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_init),
(gst_ffmpegenc_link), (gst_ffmpegenc_chain_video):
Remove EMU_EDGE, since that really fixes #162905. Revert
previous hacks.
This commit is contained in:
Ronald S. Bultje 2005-01-17 13:35:06 +00:00
parent b7411c3e84
commit 3643177798
2 changed files with 16 additions and 16 deletions

View file

@ -1,3 +1,10 @@
2005-01-17 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_init),
(gst_ffmpegenc_link), (gst_ffmpegenc_chain_video):
Remove EMU_EDGE, since that really fixes #162905. Revert
previous hacks.
2005-01-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2005-01-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_chain_video): * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_chain_video):

View file

@ -252,7 +252,6 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
ffmpegenc->context = avcodec_alloc_context (); ffmpegenc->context = avcodec_alloc_context ();
ffmpegenc->picture = avcodec_alloc_frame (); ffmpegenc->picture = avcodec_alloc_frame ();
ffmpegenc->opened = FALSE; ffmpegenc->opened = FALSE;
ffmpegenc->cache = NULL;
if (oclass->in_plugin->type == CODEC_TYPE_VIDEO) { if (oclass->in_plugin->type == CODEC_TYPE_VIDEO) {
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video); gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video);
@ -382,9 +381,6 @@ gst_ffmpegenc_link (GstPad * pad, const GstCaps * caps)
ffmpegenc->context->qmax = 15; ffmpegenc->context->qmax = 15;
ffmpegenc->context->max_qdiff = 3; ffmpegenc->context->max_qdiff = 3;
/* no edges */
ffmpegenc->context->flags |= CODEC_FLAG_EMU_EDGE;
/* fetch pix_fmt and so on */ /* fetch pix_fmt and so on */
gst_ffmpeg_caps_with_codectype (oclass->in_plugin->type, gst_ffmpeg_caps_with_codectype (oclass->in_plugin->type,
caps, ffmpegenc->context); caps, ffmpegenc->context);
@ -459,14 +455,14 @@ static void
gst_ffmpegenc_chain_video (GstPad * pad, GstData * _data) gst_ffmpegenc_chain_video (GstPad * pad, GstData * _data)
{ {
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (gst_pad_get_parent (pad)); GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (gst_pad_get_parent (pad));
GstBuffer *inbuf = GST_BUFFER (_data), *old_cache = ffmpegenc->cache; GstBuffer *inbuf = GST_BUFFER (_data), *outbuf;
GstFFMpegEncClass *oclass = GstFFMpegEncClass *oclass =
(GstFFMpegEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc)); (GstFFMpegEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
gint ret_size = 0; gint ret_size = 0;
/* FIXME: events (discont (flush!) and eos (close down) etc.) */ /* FIXME: events (discont (flush!) and eos (close down) etc.) */
ffmpegenc->cache = gst_buffer_new_and_alloc (ffmpegenc->buffer_size); outbuf = gst_buffer_new_and_alloc (ffmpegenc->buffer_size);
gst_ffmpeg_avpicture_fill ((AVPicture *) ffmpegenc->picture, gst_ffmpeg_avpicture_fill ((AVPicture *) ffmpegenc->picture,
GST_BUFFER_DATA (inbuf), GST_BUFFER_DATA (inbuf),
@ -475,25 +471,22 @@ gst_ffmpegenc_chain_video (GstPad * pad, GstData * _data)
ffmpegenc->picture->pts = GST_BUFFER_TIMESTAMP (inbuf) / 1000; ffmpegenc->picture->pts = GST_BUFFER_TIMESTAMP (inbuf) / 1000;
gst_buffer_ref (ffmpegenc->cache);
ret_size = avcodec_encode_video (ffmpegenc->context, ret_size = avcodec_encode_video (ffmpegenc->context,
GST_BUFFER_DATA (ffmpegenc->cache), GST_BUFFER_DATA (outbuf),
GST_BUFFER_MAXSIZE (ffmpegenc->cache), ffmpegenc->picture); GST_BUFFER_MAXSIZE (outbuf), ffmpegenc->picture);
if (old_cache)
gst_buffer_unref (old_cache);
if (ret_size < 0) { if (ret_size < 0) {
GST_ELEMENT_ERROR (ffmpegenc, LIBRARY, ENCODE, (NULL), GST_ELEMENT_ERROR (ffmpegenc, LIBRARY, ENCODE, (NULL),
("ffenc_%s: failed to encode buffer", oclass->in_plugin->name)); ("ffenc_%s: failed to encode buffer", oclass->in_plugin->name));
gst_buffer_unref (inbuf); gst_buffer_unref (inbuf);
gst_buffer_unref (ffmpegenc->cache); gst_buffer_unref (outbuf);
return; return;
} }
GST_BUFFER_SIZE (ffmpegenc->cache) = ret_size; GST_BUFFER_SIZE (outbuf) = ret_size;
GST_BUFFER_TIMESTAMP (ffmpegenc->cache) = GST_BUFFER_TIMESTAMP (inbuf); GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
GST_BUFFER_DURATION (ffmpegenc->cache) = GST_BUFFER_DURATION (inbuf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
gst_pad_push (ffmpegenc->srcpad, GST_DATA (ffmpegenc->cache)); gst_pad_push (ffmpegenc->srcpad, GST_DATA (outbuf));
gst_buffer_unref (inbuf); gst_buffer_unref (inbuf);
} }