[FFmpeg-devel] [PATCH/RFC] Issue 502 : vorbis_enc does not set?coded_frame- >pts

Michael Niedermayer michaelni
Tue Sep 9 20:20:29 CEST 2008

On Tue, Sep 09, 2008 at 08:21:49PM +0530, Jai Menon wrote:
> Hi,
> On Tuesday 09 Sep 2008 1:09:32 am Michael Niedermayer wrote:
> > On Wed, Sep 03, 2008 at 08:40:00PM +0530, Jai Menon wrote:
> > > Hi,
> > >
> > > I was going through the bugtracker and saw this issue. I've been using
> > > the attached fix for quite some time and it works for me. That is, I'm
> > > able to seek properly within the stream in other players based on the
> > > reference decoder. I'm not sure if its the way to go though...
> >
> > The patch is ok until the API gets fixed so AVFrame (with .pts) is used
> > as input for audio encoders
> >
> Thanks. Patch applied.
> Should the issue be closed or should it be kept open till the API change is in 
> place?

i dont know ...

> Also, is there anything specific that keeps us from "fixing" the API? I guess 
> it would break the ABI, and require a major version bump... 
> Anyhow, I would be glad to help out if it requires some grunt work ;)

its rather simple, just replace all
avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples)
avcodec_encode_audio(AVCodecContext *avctx, AVPacket *pkt, AVFrame *frame)

and similar for AVCodec->encode

buf      == pkt->data
buf_size == pkt->size
samples  == frame->data[0]

pkt->flags/pts should be set to what coded_frame->pts/key_frame is currently
and based on what is input through frame->pts

Above is the idea, its of course possible that problems would be found during
the convertion that may require changes to this plan.

We also could add a new AFrame struct just for audio to avoid video specific
fields ...

The whole should not be particularely hard just alot of work because there are
alot of codecs. It also is cerainly a good idea if the change could be done
in smaller steps, possibly introducing a 
AVCodec->encode2() / avcodec_encode_audio2() temporarly, it really depends on
which way the one doing it prefers.

and about the major ver bump, well we just bumped it and ive made it clear in
svn log that the new ABI/API isnt stable yet so no bump should be needed.

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20080909/54be752d/attachment.pgp>

More information about the ffmpeg-devel mailing list