Re: [Libav-user] Decoding/encoding api

2016-09-16 Thread Timur Guseynov
Thanks! Will try it out.

пт, 16 сент. 2016 г. в 13:56, Steve <musicspeedchan...@gmail.com>:

> Timur Guseynov wrote
> > So I can write something like this and it would be ok?
> >
> > AVCodecContext *codecContext;
> > AVPacket *packet;
> > AVFrame *frame;
> > // allocating codec context, getting packet
> > .
> > //
> > avcodec_send_packet(codecContext, packet);
> > while(avcodec_receive_frame(codecContext, frame) == 0)
> > {
> >   av_frame_unref(frame);
> > }
>
> No, that's where the doc you were referring to comes in, av_frame_unref is
> called for you. But you have to handle the packet, so:
>
> avcodec_send_packet(codecContext, packet);
> while(avcodec_receive_frame(codecContext, frame) == 0)
> {
> ..
> }
>  av_packet_unref(packet);
>
>
>
>
>
> --
> View this message in context:
> http://libav-users.943685.n4.nabble.com/Libav-user-Decoding-encoding-api-tp4662664p4662679.html
> Sent from the libav-users mailing list archive at Nabble.com.
> ___
> Libav-user mailing list
> Libav-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Decoding/encoding api

2016-09-16 Thread Steve
Timur Guseynov wrote
> So I can write something like this and it would be ok?
> 
> AVCodecContext *codecContext;
> AVPacket *packet;
> AVFrame *frame;
> // allocating codec context, getting packet
> .
> //
> avcodec_send_packet(codecContext, packet);
> while(avcodec_receive_frame(codecContext, frame) == 0)
> {
>   av_frame_unref(frame);
> }

No, that's where the doc you were referring to comes in, av_frame_unref is
called for you. But you have to handle the packet, so:

avcodec_send_packet(codecContext, packet);
while(avcodec_receive_frame(codecContext, frame) == 0)
{
..
}
 av_packet_unref(packet);





--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Decoding-encoding-api-tp4662664p4662679.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Decoding/encoding api

2016-09-16 Thread Timur Guseynov
So I can write something like this and it would be ok?

AVCodecContext *codecContext;
AVPacket *packet;
AVFrame *frame;
// allocating codec context, getting packet
.
//
avcodec_send_packet(codecContext, packet);
while(avcodec_receive_frame(codecContext, frame) == 0)
{
  av_frame_unref(frame);
}

пт, 16 сент. 2016 г. в 2:26, Steve <musicspeedchan...@gmail.com>:

> Timur Guseynov wrote
> > I'm a bit confused with decoding/encoding api. I've read this
> > https://ffmpeg.org/doxygen/3.1/group__lavc__encdec.html;
> > documentation and
> > it says "Receive output in a loop. Periodically call one of the
> > avcodec_receive_*()...".
> >
> > avcodec_receive_frame() docs say "the function will always call
> > av_frame_unref(frame) before doing anything else." The same goes for
> > avcodec_receive_packet().
> >
> > So, for example, I will write such code:
> >
> > AVCodecContext *codecContext;
> > AVPacket *packet;
> > AVFrame *frame;
> > // allocating codec context, getting packet
> > .
> > //
> > avcodec_send_packet(codecContext, packet);
> > while(avcodec_receive_frame(codecContext, frame) == 0)
> > {
> > }
> >
> > Will this code be functioning right?
> >
> > ___
> > Libav-user mailing list
>
> > Libav-user@
>
> > http://ffmpeg.org/mailman/listinfo/libav-user
>
> The doc for avcodec_receive_packet has  you need to check a typo, it calls
> av_packet_unref. This is just convenience, you would have to call
> av_packet_unref or av_frame_unref yourself otherwise on each turn.
>
> Your code would be ok but you need to call av_packet_unref at the end
> because you retain ownership of the packet.
>
>
>
> --
> View this message in context:
> http://libav-users.943685.n4.nabble.com/Libav-user-Decoding-encoding-api-tp4662664p4662672.html
> Sent from the libav-users mailing list archive at Nabble.com.
> ___
> Libav-user mailing list
> Libav-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Decoding/encoding api

2016-09-15 Thread Steve
Timur Guseynov wrote
> I'm a bit confused with decoding/encoding api. I've read this
> https://ffmpeg.org/doxygen/3.1/group__lavc__encdec.html;
> documentation and
> it says "Receive output in a loop. Periodically call one of the
> avcodec_receive_*()...".
> 
> avcodec_receive_frame() docs say "the function will always call
> av_frame_unref(frame) before doing anything else." The same goes for
> avcodec_receive_packet().
> 
> So, for example, I will write such code:
> 
> AVCodecContext *codecContext;
> AVPacket *packet;
> AVFrame *frame;
> // allocating codec context, getting packet
> .
> //
> avcodec_send_packet(codecContext, packet);
> while(avcodec_receive_frame(codecContext, frame) == 0)
> {
> }
> 
> Will this code be functioning right?
> 
> ___
> Libav-user mailing list

> Libav-user@

> http://ffmpeg.org/mailman/listinfo/libav-user

The doc for avcodec_receive_packet has  you need to check a typo, it calls
av_packet_unref. This is just convenience, you would have to call
av_packet_unref or av_frame_unref yourself otherwise on each turn.

Your code would be ok but you need to call av_packet_unref at the end
because you retain ownership of the packet.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Decoding-encoding-api-tp4662664p4662672.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Decoding/encoding api

2016-09-15 Thread Timur Guseynov
I'm a bit confused with decoding/encoding api. I've read this
 documentation and
it says "Receive output in a loop. Periodically call one of the
avcodec_receive_*()...".

avcodec_receive_frame() docs say "the function will always call
av_frame_unref(frame) before doing anything else." The same goes for
avcodec_receive_packet().

So, for example, I will write such code:

AVCodecContext *codecContext;
AVPacket *packet;
AVFrame *frame;
// allocating codec context, getting packet
.
//
avcodec_send_packet(codecContext, packet);
while(avcodec_receive_frame(codecContext, frame) == 0)
{
}

Will this code be functioning right?
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user