ffmpeg: adapt to the buffersrc API changes.

This commit is contained in:
Nicolas George 2012-05-18 13:59:48 +02:00
parent aa1246ea42
commit 00be2f5726
1 changed files with 4 additions and 27 deletions

View File

@ -810,13 +810,8 @@ static int configure_audio_filters(FilterGraph *fg, AVFilterContext **in_filter,
if (!(fg->graph = avfilter_graph_alloc())) if (!(fg->graph = avfilter_graph_alloc()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
#ifdef SRCA
snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:" snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:"
"channel_layout=0x%"PRIx64, ist->st->time_base.num, "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, ist->st->time_base.den, icodec->sample_rate,
av_get_sample_fmt_name(icodec->sample_fmt), icodec->channel_layout); av_get_sample_fmt_name(icodec->sample_fmt), icodec->channel_layout);
ret = avfilter_graph_create_filter(&fg->inputs[0]->filter, ret = avfilter_graph_create_filter(&fg->inputs[0]->filter,
@ -2426,11 +2421,8 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
/* no audio frame */ /* no audio frame */
if (!pkt->size) if (!pkt->size)
for (i = 0; i < ist->nb_filters; i++) for (i = 0; i < ist->nb_filters; i++)
#ifdef SRCA av_buffersrc_add_ref(ist->filters[i]->filter, NULL,
av_buffersrc_buffer(ist->filters[i]->filter, NULL); AV_BUFFERSRC_FLAG_NO_COPY);
#else
av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
#endif
return ret; return ret;
} }
@ -2497,13 +2489,8 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
} }
} }
for (i = 0; i < ist->nb_filters; i++) { for (i = 0; i < ist->nb_filters; i++)
#ifdef SRCA
av_buffersrc_write_frame(ist->filters[i]->filter, decoded_frame);
#else
av_buffersrc_add_frame(ist->filters[i]->filter, decoded_frame, 0); av_buffersrc_add_frame(ist->filters[i]->filter, decoded_frame, 0);
#endif
}
return ret; return ret;
} }
@ -2538,11 +2525,7 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
/* no picture yet */ /* no picture yet */
if (!pkt->size) if (!pkt->size)
for (i = 0; i < ist->nb_filters; i++) for (i = 0; i < ist->nb_filters; i++)
#ifdef SRCA av_buffersrc_add_ref(ist->filters[i]->filter, NULL, AV_BUFFERSRC_FLAG_NO_COPY);
av_buffersrc_buffer(ist->filters[i]->filter, NULL);
#else
av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
#endif
return ret; return ret;
} }
@ -2606,17 +2589,11 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
av_assert0(buf->refcount>0); av_assert0(buf->refcount>0);
buf->refcount++; 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_add_ref(ist->filters[i]->filter, fb,
AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT | AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT |
AV_BUFFERSRC_FLAG_NO_COPY); AV_BUFFERSRC_FLAG_NO_COPY);
} else } else
if(av_buffersrc_add_frame(ist->filters[i]->filter, decoded_frame, 0)<0) { 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"); av_log(NULL, AV_LOG_FATAL, "Failed to inject frame into filter network\n");
exit_program(1); exit_program(1);
} }