Hi, this is a function taken from an ffmpeg example
How can I fill the frame with my data buffer (const uchar* data, int Length)?

***************************************
    AVFrame *frame = OutputStreamAudio.pAVFrameTemp;
    int j, i, v;
    int16_t *q = (int16_t*)frame->data[0];

    /* check if we want to generate more frames */
    if (av_compare_ts(OutputStreamAudio.next_pts, 
OutputStreamAudio.pAVCodecContext->time_base, STREAM_DURATION, (AVRational){ 1, 
1 }) >= 0) return NULL;

    for (j = 0; j <frame->nb_samples; j++) {
        v = (int)(sin(OutputStreamAudio.t) * 10000);
        for (i = 0; i < OutputStreamAudio.pAVCodecContext->channels; i++) *q++ 
= v;
        OutputStreamAudio.t     += OutputStreamAudio.tincr;
        OutputStreamAudio.tincr += OutputStreamAudio.tincr2;
    }

    frame->pts = OutputStreamAudio.next_pts;
    OutputStreamAudio.next_pts  += frame->nb_samples;

    return frame;
***************************************

Regards


+39.347.4070897
http://www.labcsp.com[1]
http://www.denisgottardello.it[2]
GMT+1
Skype: mrdebug

--------
[1] http://www.labcsp.com
[2] http://www.denisgottardello.it
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to