[FFmpeg-devel] [PATCH] CD+G Demuxer & Decoder
Vitor Sessak
vitor1001
Thu Dec 17 18:26:01 CET 2009
Michael Niedermayer wrote:
> On Tue, Dec 15, 2009 at 07:56:33PM -0800, Michael Tison wrote:
>> Revised patch attached.
>>
>> On Tue, Dec 15, 2009 at 2:06 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>>> On Mon, Dec 14, 2009 at 06:40:17PM -0800, Michael Tison wrote:
>>> [...]
>>>> + h_off = FFMIN(data[1] & 0x07, CDG_BORDER_WIDTH - 1);
>>>> + v_off = FFMIN(data[2] & 0x07, CDG_BORDER_HEIGHT - 1);
>>>> +
>>>> + /// find the difference and save the offset for cdg_tile_block usage
>>>> + dh_off = h_off - cc->hscroll;
>>>> + dv_off = v_off - cc->vscroll;
>>>> + cc->hscroll = h_off;
>>>> + cc->vscroll = v_off;
>>>> +
>>>> + if (vscmd == UP)
>>>> + vinc = -12;
>>>> + if (vscmd == DOWN)
>>>> + vinc = 12;
>>>> + if (hscmd == LEFT)
>>>> + hinc = -6;
>>>> + if (hscmd == RIGHT)
>>>> + hinc = 6;
>>>> + vinc += dv_off;
>>>> + hinc += dh_off;
>>>> +
>>>> + if (!hinc && !vinc)
>>>> + return;
>>> if (vscmd == UP)
>>> dv_off -= 12;
>>> if (vscmd == DOWN)
>>> dv_off += 12;
>>> ...
>>> if(!vscmd && !hscmd) (or ==3 i dont know which is the do nothing case)
>>> return
>> Compacted.
>>
>>> [...]
>>>> +static int read_header(AVFormatContext *s, AVFormatParameters *ap)
>>>> +{
>>>> + AVStream *vst;
>>>> + int ret;
>>>> +
>>>> + vst = av_new_stream(s, 0);
>>>> + if (!vst)
>>>> + return AVERROR(ENOMEM);
>>>> +
>>>> + vst->codec->codec_type = CODEC_TYPE_VIDEO;
>>>> + vst->codec->codec_id = CODEC_ID_CDGRAPHICS;
>>>> +
>>>> + /// 75 sectors/sec * 4 packets/sector = 300 packets/sec
>>>> + av_set_pts_info(vst, 32, 1, 300);
>>>> +
>>>> + ret = url_fsize(s->pb);
>>>> + if (ret < 0)
>>>> + return ret;
>>> i think failing in this case is unreasonable
>> Okay makes sense.
>>
>> Michael
>
>> Changelog | 1
>> doc/general.texi | 4
>> libavcodec/Makefile | 1
>> libavcodec/allcodecs.c | 1
>> libavcodec/avcodec.h | 1
>> libavcodec/cdgraphics.c | 380 +++++++++++++++++++++++++++++++++++++++++++++++
>> libavformat/Makefile | 1
>> libavformat/allformats.c | 1
>> libavformat/avformat.h | 2
>> libavformat/cdg.c | 66 ++++++++
>> 10 files changed, 457 insertions(+), 1 deletion(-)
>> ac5acde84756bac6aedb65f2583adcc870d7b60b cdgraphicsv9.patch
>
> looks ok assuming its tested & works (test against some fuzzer without
> it crashing is probably also a good idea)
Tested with two samples and tools/trasher and applied.
-Vitor
More information about the ffmpeg-devel
mailing list