[FFmpeg-devel] [PATCH 5/5] ffmpeg: adapt to the buffersrc API changes.
Nicolas George
nicolas.george at normalesup.org
Fri May 18 15:15:41 CEST 2012
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
ffmpeg.c | 31 ++++---------------------------
1 file changed, 4 insertions(+), 27 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index a348624..befb107 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -807,13 +807,8 @@ static int configure_audio_filters(FilterGraph *fg, AVFilterContext **in_filter,
if (!(fg->graph = avfilter_graph_alloc()))
return AVERROR(ENOMEM);
-#ifdef SRCA
snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:"
"channel_layout=0x%"PRIx64, ist->st->time_base.num,
-#else
- snprintf(args, sizeof(args), "%d/%d:%d:%s:"
- "0x%"PRIx64, ist->st->time_base.num,
-#endif
ist->st->time_base.den, icodec->sample_rate,
av_get_sample_fmt_name(icodec->sample_fmt), icodec->channel_layout);
ret = avfilter_graph_create_filter(&fg->inputs[0]->filter,
@@ -2401,11 +2396,8 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
/* no audio frame */
if (!pkt->size)
for (i = 0; i < ist->nb_filters; i++)
-#ifdef SRCA
- av_buffersrc_buffer(ist->filters[i]->filter, NULL);
-#else
- av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
-#endif
+ av_buffersrc_add_ref(ist->filters[i]->filter, NULL,
+ AV_BUFFERSRC_FLAG_NO_COPY);
return ret;
}
@@ -2472,13 +2464,8 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
}
}
- for (i = 0; i < ist->nb_filters; i++) {
-#ifdef SRCA
- av_buffersrc_write_frame(ist->filters[i]->filter, decoded_frame);
-#else
+ for (i = 0; i < ist->nb_filters; i++)
av_buffersrc_add_frame(ist->filters[i]->filter, decoded_frame, 0);
-#endif
- }
return ret;
}
@@ -2513,11 +2500,7 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
/* no picture yet */
if (!pkt->size)
for (i = 0; i < ist->nb_filters; i++)
-#ifdef SRCA
- av_buffersrc_buffer(ist->filters[i]->filter, NULL);
-#else
- av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
-#endif
+ av_buffersrc_add_ref(ist->filters[i]->filter, NULL, AV_BUFFERSRC_FLAG_NO_COPY);
return ret;
}
@@ -2581,17 +2564,11 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
av_assert0(buf->refcount>0);
buf->refcount++;
-#ifdef SRCA
- av_buffersrc_buffer(ist->filters[i]->filter, fb);
- } else
- if(av_buffersrc_write_frame(ist->filters[i]->filter, decoded_frame)<0) {
-#else
av_buffersrc_add_ref(ist->filters[i]->filter, fb,
AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT |
AV_BUFFERSRC_FLAG_NO_COPY);
} else
if(av_buffersrc_add_frame(ist->filters[i]->filter, decoded_frame, 0)<0) {
-#endif
av_log(NULL, AV_LOG_FATAL, "Failed to inject frame into filter network\n");
exit_program(1);
}
--
1.7.10
More information about the ffmpeg-devel
mailing list