[FFmpeg-devel] [PATCH 2/5] lavf: inject sample skip side data when requested by the demuxer

Nicolas George nicolas.george at normalesup.org
Thu Jul 5 17:56:19 CEST 2012


Le septidi 17 messidor, an CCXX, Michael Niedermayer a écrit :
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/avformat.h |    5 +++++
>  libavformat/utils.c    |    8 ++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 807c7ac..457845d 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -805,6 +805,11 @@ typedef struct AVStream {
>       * should be discarded.
>       */
>      int skip_to_keyframe;
> +
> +    /**
> +     * Number of samples to skip.
> +     */
> +    int skip_samples;

"Number of samples to skip at the start of the frame decoded from the next
packet"?

>  } AVStream;
>  
>  #define AV_PROGRAM_RUNNING 1
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 70f8d46..931e3fb 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -1449,6 +1449,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
>      }
>  
>  return_packet:
> +
> +    if(s->streams[pkt->stream_index]->skip_samples) {
> +        uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
> +        AV_WL32(p  , s->streams[pkt->stream_index]->skip_samples);

Strange spacing.

> +        av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", s->streams[pkt->stream_index]->skip_samples);
> +        s->streams[pkt->stream_index]->skip_samples = 0;
> +    }
> +

There is no way of setting the skip for the end of the packet, nor the
reason for the skip. OggOpus would possibly need the latter (but I need to
think some more about it).

>      if (is_relative(pkt->dts))
>          pkt->dts -= RELATIVE_TS_BASE;
>      if (is_relative(pkt->pts))

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120705/d886bd91/attachment.asc>


More information about the ffmpeg-devel mailing list