[FFmpeg-devel] Fwd: [PATCH] Psygnosis YOP demuxer

Mohamed Naufal naufal11
Mon Mar 8 19:57:52 CET 2010


On 22 February 2010 01:40, Michael Niedermayer <michaelni at gmx.at> wrote:

> On Thu, Feb 18, 2010 at 05:35:59PM +0530, Mohamed Naufal wrote:
> > On 15 January 2010 05:41, Michael Niedermayer <michaelni at gmx.at> wrote:
> >
> >
> > [...]
> >
> >
> > > > +typedef struct YopDecContext {
> > > > +    AVFrame frame;
> > > > +    AVCodecContext *avctx;
> > > > +    AVPacket *avpkt;
> > > > +
> > > > +    int num_pal_colors;
> > > > +    int first_color[2];
> > > > +    int tag_needs_next_byte;
> > >
> > > > +    int current_tag_byte;
> > >
> > > you dont need that variable
> > >
> >
> > If I don't increment s->srcptr in the if block of yop_get_next_nibble(),
> > color_num in yop_paint_block() can have an incorrect value.
>
> you dont need the current_tag_byte variable
>


What I meant to say was if incrementing s->srcptr is postponed to the else
block and yop_paint_block is called immediately after the if block, the
local variable
color_num = *(s->srcptr + paint_lut[tag][i])
will have an incorrect value.
Therefore s->srcptr is incremented in the if block and the original value
stored in current_tag_byte.

[...]


> > > +    firstcolor = s->first_color[s->avctx->frame_number & 1];
> > >
> > > this will be wrong with seeking id suspect
> > >
> >
> >
> > How else do I do it?
>
> Either the demuxer marks only even frames as keyframe then the decoder
> can when it detects seeking start counting from even
> or
> the demuxer has to indicate if a frame is even or odd to the decoder
> also there is the question if they are keyframes or not, you obviosuly
> should not mark then incorrectly
>

Now checked using (pkt->pos - HDR_SIZE) / frame_size & 1
Hope this is OK.


> [...]
> > +    s->row_pos = 0;
> > +
> > +    while ((size_t) s->dstptr - (size_t) s->dstbuf <
> > +           avctx->width * RGB_COLORS * avctx->height &&
> > +           (size_t) s->srcptr - (size_t) avpkt->data < avpkt->size) {
> > +        current_nibble = yop_get_next_nibble(s);
>
> useless casts
>

Fixed.


>
>
> [...]
> > +AVInputFormat yop_demuxer = {
> > +    "yop",
> > +    NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
> > +    sizeof(YopDecContext),
> > +    yop_probe,
> > +    yop_read_header,
> > +    yop_read_packet,
> > +    yop_read_close,
> > +    .extensions = "yop",
> > +    .flags = AVFMT_GENERIC_INDEX,
> > +};
>
> thats missing code to flush the buffered packet in case of seeking
>

Don't the buffered packets get freed in av_seek_frame_generic()?. I must be
missing something. Anyway, the demuxer now uses a custom seeking function
and seeking works without any problems.

Naufal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yop.patch
Type: text/x-patch
Size: 19432 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100309/4df06b19/attachment.bin>



More information about the ffmpeg-devel mailing list