[FFmpeg-devel] [PATCH] Allow bit stream filters to be applied to input

Michael Niedermayer michaelni
Mon May 4 12:34:33 CEST 2009


On Mon, May 04, 2009 at 04:43:45PM +1200, Paul Kendall wrote:
> This patch allows the -absf, -vbsf & -sbsf to be applied to ffmpeg input
> files. The bitstream filter will be applied before decoding.
> 
> Comments welcome.

[...]

> @@ -502,9 +503,7 @@
>      return (double)(ist->pts - start_time)/AV_TIME_BASE;
>  }
>  
> -static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
> -    int ret;
> -
> +static void apply_filters(AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
>      while(bsfc){
>          AVPacket new_pkt= *pkt;
>          int a= av_bitstream_filter_filter(bsfc, avctx, NULL,
> @@ -526,7 +525,13 @@
>  
>          bsfc= bsfc->next;
>      }
> +}
>  
> +static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
> +    int ret;
> +
> +    apply_filters(pkt, avctx, bsfc);
> +
>      ret= av_interleaved_write_frame(s, pkt);
>      if(ret < 0){
>          print_error("av_interleaved_write_frame()", ret);

factorizing out apply_filters() should be a seperate patch


> @@ -702,7 +707,7 @@
>              if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
>                  pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
>              pkt.flags |= PKT_FLAG_KEY;
> -            write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
> +            write_frame(s, &pkt, ost->st->codec, output_bitstream_filters[ost->file_index][pkt.stream_index]);
>  
>              ost->sync_opts += enc->frame_size;
>          }

renaming variables should also be a seperate patch


[...]
> @@ -1219,6 +1224,9 @@
>          if(avpkt.size && avpkt.size != pkt->size && verbose>0)
>              fprintf(stderr, "Multiple frames in a packet from stream %d\n", pkt->stream_index);
>  
> +        /* apply bitstream filters */
> +        apply_filters(&avpkt, ist->st->codec, input_bitstream_filters[ist->file_index][ist_index]);
> +        
>          /* decode the packet if needed */
>          data_buf = NULL; /* fail safe */
>          data_size = 0;

trailing whitespace is forbidden in svn



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090504/67eb28bc/attachment.pgp>



More information about the ffmpeg-devel mailing list