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

Mohamed Naufal naufal11
Thu Mar 18 01:12:13 CET 2010


On 18 March 2010 05:01, Michael Niedermayer <michaelni at gmx.at> wrote:


[...]

>> +
>> + ? ? ? ?yop_get_next_nibble(s, &current_byte);
>> +
>
>> + ? ? ? ?if ((current_byte & 0xf0) != 0xf0) {
>> + ? ? ? ? ? ?yop_paint_block(s, current_byte >> 4);
>> + ? ? ? ?}else {
>> + ? ? ? ? ? ?yop_get_next_nibble(s, &current_byte);
>> + ? ? ? ? ? ?yop_copy_previous_block(s, current_byte >> 4);
>> + ? ? ? ?}
>
> extracting the top 4bits is done several times


I can't think of any other way to eliminate the current_tag_byte
variable in the previous patch :(

>
>
> [...]
>> +static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
>> +{
>> + ? ?YopDecContext *yop = s->priv_data;
>> + ? ?ByteIOContext *pb ?= s->pb;
>> +
>> + ? ?int ret;
>> + ? ?int palette_size ? ? ? ? ? = 4 + yop->num_pal_colors * 3;
>> + ? ?int actual_video_data_size = yop->frame_size -
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? yop->audio_block_length - palette_size;
>> +
>> + ? ?yop->video_packet.stream_index = 1;
>> +
>> + ? ?if (yop->video_packet.data) {
>> + ? ? ? ?*pkt ? ? ? ? ? ? ? ? ? = ?yop->video_packet;
>> + ? ? ? ?yop->video_packet.data = ?NULL;
>> + ? ? ? ?yop->video_packet.size = ?0;
>> +
>> + ? ? ? ?if (!yop->odd_frame)
>> + ? ? ? ? ? ?pkt->flags |= PKT_FLAG_KEY;
> [...]
>> +static int yop_read_seek(AVFormatContext *s, int stream_index,
>> + ? ? ? ? ? ? ? ? ? ? ? ? int64_t timestamp, int flags)
>> +{
>> + ? ?YopDecContext *yop = s->priv_data;
>> + ? ?int64_t frame_pos, pos_min, pos_max;
>> +
>> + ? ?av_free_packet(&yop->video_packet);
>> +
>> + ? ?pos_min = s->data_offset;
>> + ? ?pos_max = url_fsize(s->pb) - yop->frame_size;
>> +
>> + ? ?if(!stream_index)
>> + ? ? ? ?return -1;
>> +
>> + ? ?frame_pos ? ? ?= timestamp * yop->frame_size + pos_min;
>> + ? ?yop->odd_frame = timestamp & 1;
>
> this code is a bit inconsistent.
> are half of the frames really more keyframe than the other
> half? if not you cannot set keyframe for one half different than the
> other.


Can I set the flag to some other value? If not, is there some other
way the demuxer can tell the decoder if a frame is odd/even?

> if they are you cannot seek to one half


Shouldn't
    frame_pos = timestamp * frame_size + pos_min;
    seek(frame_pos);
take care of that?

[...]

Naufal



More information about the ffmpeg-devel mailing list