[FFmpeg-devel] [PATCH 3/4] lavf/concat: switch to new BSF API.
Michael Niedermayer
michael at niedermayer.cc
Thu May 19 22:42:04 CEST 2016
On Thu, May 19, 2016 at 09:47:11AM +0200, Nicolas George wrote:
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
> libavformat/concatdec.c | 165 ++++++++++++++++++++++--------------------------
> 1 file changed, 76 insertions(+), 89 deletions(-)
>
>
> Unchanged.
>
>
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index b3a430e..bbea158 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -34,7 +34,7 @@ typedef enum ConcatMatchMode {
> } ConcatMatchMode;
>
> typedef struct ConcatStream {
> - AVBitStreamFilterContext *bsf;
> + AVBSFContext *bsf;
> AVCodecContext *avctx;
> int out_stream_index;
> } ConcatStream;
> @@ -58,6 +58,7 @@ typedef struct {
> ConcatFile *cur_file;
> unsigned nb_files;
> AVFormatContext *avf;
> + ConcatStream *active_bsf;
> int safe;
> int seekable;
> int eof;
> @@ -195,39 +196,54 @@ static int detect_stream_specific(AVFormatContext *avf, int idx)
> {
> ConcatContext *cat = avf->priv_data;
> AVStream *st = cat->avf->streams[idx];
> + AVStream *ost;
> ConcatStream *cs = &cat->cur_file->streams[idx];
> - AVBitStreamFilterContext *bsf;
> + AVBSFContext *bsf = NULL;
> + const AVBitStreamFilter *filter;
> + const char *filter_name = NULL;
> int ret;
>
> - if (cat->auto_convert && st->codecpar->codec_id == AV_CODEC_ID_H264 &&
> - (st->codecpar->extradata_size < 4 || AV_RB32(st->codecpar->extradata) != 1)) {
> - av_log(cat->avf, AV_LOG_INFO,
> - "Auto-inserting h264_mp4toannexb bitstream filter\n");
> - if (!(bsf = av_bitstream_filter_init("h264_mp4toannexb"))) {
> - av_log(avf, AV_LOG_ERROR, "h264_mp4toannexb bitstream filter "
> - "required for H.264 streams\n");
> - return AVERROR_BSF_NOT_FOUND;
> - }
> - cs->bsf = bsf;
> -
> - cs->avctx = avcodec_alloc_context3(NULL);
> - if (!cs->avctx)
> - return AVERROR(ENOMEM);
> -
> - /* This really should be part of the bsf work.
> - Note: input bitstream filtering will not work with bsf that
> - create extradata from the first packet. */
> - av_freep(&st->codecpar->extradata);
> - st->codecpar->extradata_size = 0;
> + if (cs->out_stream_index < 0)
> + return 0;
> + ost = avf->streams[cs->out_stream_index];
>
> - ret = avcodec_parameters_to_context(cs->avctx, st->codecpar);
> - if (ret < 0) {
> - avcodec_free_context(&cs->avctx);
> - return ret;
> - }
> + if (cat->auto_convert && st->codecpar->codec_id == AV_CODEC_ID_H264 &&
> + (st->codecpar->extradata_size < 4 || AV_RB32(st->codecpar->extradata) != 1))
> + filter_name = "h264_mp4toannexb";
>
> + if (filter_name)
> + av_log(cat->avf, AV_LOG_INFO,
> + "Auto-inserting %s bitstream filter\n", filter_name);
> + else
> + filter_name = "null";
is the overhead from the null filter insiginicant ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160519/c88dae1f/attachment.sig>
More information about the ffmpeg-devel
mailing list