mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
Loop through input capses instead of just picking the first, and handle encoding errors
Original commit message from CVS: Loop through input capses instead of just picking the first, and handle encoding errors
This commit is contained in:
parent
49b22bcee6
commit
40deef896e
1 changed files with 24 additions and 10 deletions
|
@ -284,11 +284,6 @@ gst_ffmpegenc_connect (GstPad *pad,
|
|||
ffmpegenc->context->qmax = 15;
|
||||
ffmpegenc->context->max_qdiff = 3;
|
||||
|
||||
/* fill in the context (width/height/pixfmt or
|
||||
* rate/channels/samplefmt) */
|
||||
gst_ffmpeg_caps_to_codectype (oclass->in_plugin->type,
|
||||
caps, ffmpegenc->context);
|
||||
|
||||
/* no edges */
|
||||
ffmpegenc->context->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
|
||||
|
@ -298,11 +293,23 @@ gst_ffmpegenc_connect (GstPad *pad,
|
|||
ffmpegenc->context->frame_rate = 25 * DEFAULT_FRAME_RATE_BASE;
|
||||
ffmpegenc->context->frame_rate_base = DEFAULT_FRAME_RATE_BASE;
|
||||
|
||||
/* open codec */
|
||||
if (avcodec_open (ffmpegenc->context, oclass->in_plugin) < 0) {
|
||||
GST_DEBUG (GST_CAT_PLUGIN_INFO,
|
||||
"ffenc_%s: Failed to open FFMPEG codec",
|
||||
oclass->in_plugin->name);
|
||||
for (ret_caps = caps; ret_caps != NULL; ret_caps = ret_caps->next) {
|
||||
/* fetch pix_fmt and so on */
|
||||
gst_ffmpeg_caps_to_codectype (oclass->in_plugin->type,
|
||||
caps, ffmpegenc->context);
|
||||
|
||||
/* open codec */
|
||||
if (avcodec_open (ffmpegenc->context, oclass->in_plugin) < 0) {
|
||||
GST_DEBUG (GST_CAT_PLUGIN_INFO,
|
||||
"ffenc_%s: Failed to open FFMPEG codec",
|
||||
oclass->in_plugin->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret_caps == NULL) {
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
|
||||
|
@ -375,6 +382,13 @@ gst_ffmpegenc_chain (GstPad *pad,
|
|||
break;
|
||||
}
|
||||
|
||||
if (ret_size < 0) {
|
||||
g_warning("ffenc_%s: failed to encode buffer",
|
||||
oclass->in_plugin->name);
|
||||
gst_buffer_unref (inbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
/* bla */
|
||||
GST_BUFFER_SIZE (outbuf) = ret_size;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
|
||||
|
|
Loading…
Reference in a new issue