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

Paul Kendall paul
Tue May 5 09:15:10 CEST 2009


On Monday 04 May 2009 10:34:33 pm Michael Niedermayer wrote:
> 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
>
>
>
> [...]
Problems addressed, new separate patches attached.

Cheers,
Paul

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.1.variable-rename.patch
Type: text/x-patch
Size: 5061 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090505/15c35691/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.2.apply-filters-splitout.patch
Type: text/x-patch
Size: 830 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090505/15c35691/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.3.input-filtering.patch
Type: text/x-patch
Size: 2897 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090505/15c35691/attachment-0002.bin>



More information about the ffmpeg-devel mailing list