> You need ES frames, that is a SINGLE ES frame on each call, you cannot pass 
> any PES packet its payload with or without headers.

During processing of the PES, how do I estimate, that I have completed an ES 
frame?

I naively thought that PES packet has PTS only when it contains the start of an 
ES frame. 
And when a PES packet has PTS_DTS_flags == 00, it contains something from the 
middle of a frame.

Looks like this is not the case.
I have two successive PES packets, both have PTS_DTS_flags == 11. 
But av_parser_parse returns frame_size == 0, when I call it with the payload of 
the first packet.
Also, this is the first call of the av_parser_parse during this program run...
Does it mean, that the first PES packet doesn't contain the complete ES frame, 
and I must append the second PES packet payload to it?
 
> > buffer=el_pkt.GetPayload(&payload_size);
> > int r=av_parser_parse(st->parser,codec_ctx,&samples,&frame_size,
> >                   buffer,payload_size,el_pkt.m_PTS,el_pkt.m_DTS);
> > 
> > if(frame_size>0) {
> >   AVPacket avpacket;
> >   avpacket.pts=(el_pkt.m_PTS_DTS_flags & 0x02) ? el_pkt.m_PTS : 
AV_NOPTS_VALUE;
> >   avpacket.dts=(el_pkt.m_PTS_DTS_flags & 0x01) ? el_pkt.m_DTS : 
AV_NOPTS_VALUE;
> >   avpacket.duration=(int64_t)0;   
> >   avpacket.data=samples;
> >   avpacket.size=frame_size;
> >   int r = av_write_frame(m_pFormatCtx, &avpacket);
> > }
> 
> This code looks just invalid, first you must call the parser in a loop
> and second you must pass timestamps through it, you cannot use PES timestamps
> in av_write_frame().




_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to