[Ffmpeg-devel] Passing I/P frame info from the flashsv encoder to the flv muxer

Benjamin Larsson banan
Sat Jan 6 22:48:08 CET 2007


Hi, my flashsv encoder is almost finished for patch submission. I just
just need to know how to pass the frametype info to the flv muxer. I
tried this code but the muxer didn't catch it anyway.



int first = 1;
static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, int
buf_size, void *data)
{
    FlashSVContext * const s = (FlashSVContext *)avctx->priv_data;
    AVFrame *pict = data;
    AVFrame * const p = &s->pic;
    AVFrame temp;
    int res, w, h;

    int optim_sizes[16][16];
    int smallest_size;

    if (!s->previous_frame)
        s->previous_frame = av_mallocz(s->image_width*s->image_height*4);

    if (!s->encbuffer)
        s->encbuffer = av_mallocz(s->image_width*s->image_height*4);

    if (!s->frame.data[0]) {
        avctx->get_buffer(avctx, &s->frame);
        avctx->get_buffer(avctx, &s->prev_frame);
    }

    temp = s->frame;
    s->frame = s->prev_frame;
    s->prev_frame = temp;

    *p = *pict;
    if (first) {
        p->pict_type = FF_I_TYPE;
        p->key_frame = 1;
        first = 0;
    } else {
        p->pict_type = FF_P_TYPE;
        p->key_frame = 0;
    }


So how should I do it ?

MvH
Benjamin Larsson

-- 
new tiny signature





More information about the ffmpeg-devel mailing list