[FFmpeg-devel] [PATCH]Add Dirac support to ffmpeg via libdirac_* and Schroedinger libraries]

Michael Niedermayer michaelni
Wed Apr 9 05:12:23 CEST 2008


On Wed, Apr 09, 2008 at 12:44:29PM +1000, Anuradha Suraparaju wrote:
> 
> On Sat, 2008-04-05 at 01:44 +0200, Michael Niedermayer wrote:
> 
> 
> > [...]
> 
> > > +                
> > > +            /* set output data */
> > > +            p_frame_output->p_data=(unsigned char*)av_malloc(p_dirac_params->p_encoder->enc_buf.size);
> > > +            memcpy(p_frame_output->p_data,p_dirac_params->p_encoder->enc_buf.buffer,p_dirac_params->p_encoder->enc_buf.size);
> > > +            p_frame_output->size=p_dirac_params->p_encoder->enc_buf.size;
> > > +            p_frame_output->type=p_dirac_params->p_encoder->enc_pparams.ptype;
> > 
> > > +            if (p_dirac_params->p_next_output_frame==NULL) {
> > > +                p_dirac_params->p_next_output_frame=p_frame_output;
> > > +                p_dirac_params->p_last_output_frame=p_frame_output;
> > > +            } else {
> > > +                p_dirac_params->p_last_output_frame->p_next_frame=p_frame_output;
> > > +                p_dirac_params->p_last_output_frame=p_frame_output;
> > > +            }
> > 
> > "p_dirac_params->p_last_output_frame=p_frame_output;" can be factored out
> I'm sorry I didn't understand this comment. Does this refer to the
> statement in the if part rather than the else part?

I meant

if (p_dirac_params->p_next_output_frame==NULL) {
    p_dirac_params->p_next_output_frame=p_frame_output;
} else {
    p_dirac_params->p_last_output_frame->p_next_frame=p_frame_output;
}
p_dirac_params->p_last_output_frame=p_frame_output;


> > 
> > 
> > > +            if (state == ENC_STATE_EOS) {
> > > +                p_dirac_params->eos_pulled = 1;
> > > +                go = 0;
> > > +            }
> > > +            break;
> > > +
> > > +        case ENC_STATE_BUFFER:
> > > +            go = 0;
> > > +            break;
> > > +
> > > +        case ENC_STATE_INVALID:
> > > +            av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Encoder Error. Quitting...\n");
> > > +            return -1;
> > > +                
> > > +        default:
> > > +            av_log(avccontext, AV_LOG_ERROR, "Unknown Encoder state\n");
> > > +            return -1;
> > > +        }
> > > +    }
> > > +
> > > +    /* copy 'next' frame in queue */
> > > +    p_next_output_frame=p_dirac_params->p_next_output_frame;
> > > +    if (p_next_output_frame==NULL)
> > > +        return 0;
> > > +
> > > +    memcpy(frame, p_next_output_frame->p_data, p_next_output_frame->size);
> > > +    avccontext->coded_frame->key_frame= p_next_output_frame->type == INTRA_PICTURE;    
> > 
> > > +    avccontext->coded_frame->pts= AV_NOPTS_VALUE;    
> > 
> > This should be set to the correct pts from the matching input AVFrame.
> Does this have to be the pts from the matching input AVFrame? Or can I
> set it to the frame number of the encoded frame returned by the encoder?

The frame number should do as long as the video is constant frame rate.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- 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/20080409/3274235e/attachment.pgp>



More information about the ffmpeg-devel mailing list