On Mon, Mar 28, 2011 at 09:56:07PM -0700, Ronald S. Bultje wrote:
> Hi,
> 
> On Mon, Mar 28, 2011 at 3:36 AM, Anton Khirnov <an...@khirnov.net> wrote:
> > ---
> >  libavformat/matroskaenc.c |    2 +-
> >  libavformat/utils.c       |    7 +++++++
> >  2 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> > index 4f9bf0a..54c74a6 100644
> > --- a/libavformat/matroskaenc.c
> > +++ b/libavformat/matroskaenc.c
> > @@ -908,7 +908,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, 
> > AVIOContext *pb, AVPacket *p
> >         size -= start - data;
> >         sscanf(data, "Dialogue: %d,", &layer);
> >         i = snprintf(buffer, sizeof(buffer), "%"PRId64",%d,",
> > -                     s->streams[pkt->stream_index]->nb_frames++, layer);
> > +                     s->streams[pkt->stream_index]->nb_frames, layer);
> >         size = FFMIN(i+size, sizeof(buffer));
> >         memcpy(buffer+i, start, size-i);
> >
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index 7ece078..9b0c558 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -3005,6 +3005,9 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
> >         return ret;
> >
> >     ret= s->oformat->write_packet(s, pkt);
> > +
> > +    if (ret >= 0)
> > +        s->streams[pkt->stream_index]->nb_frames++;
> >     return ret;
> >  }
> >
> > @@ -3122,6 +3125,8 @@ int av_interleaved_write_frame(AVFormatContext *s, 
> > AVPacket *pkt){
> >             return ret;
> >
> >         ret= s->oformat->write_packet(s, &opkt);
> > +        if (ret >= 0)
> > +            s->streams[opkt.stream_index]->nb_frames++;
> >
> >         av_free_packet(&opkt);
> >         pkt= NULL;
> > @@ -3144,6 +3149,8 @@ int av_write_trailer(AVFormatContext *s)
> >             break;
> >
> >         ret= s->oformat->write_packet(s, &pkt);
> > +        if (ret >= 0)
> > +            s->streams[pkt.stream_index]->nb_frames++;
> >
> >         av_free_packet(&pkt);
> 
> Are you sure this last piece is correct? It seems to me it may end up
> that nb_frames is 1 more than the actual number of frames written for
> formats where a frame != a packet.
> 

No I'm not :)
Is there any way for lavf to know whether packet ~ frame?

-- 
Anton Khirnov

Attachment: signature.asc
Description: Digital signature

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to