[FFmpeg-devel] [PATCH] CD+G Demuxer & Decoder

Michael Niedermayer michaelni
Tue Dec 15 23:06:24 CET 2009


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

[...]
> +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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091215/bf1d448b/attachment.pgp>



More information about the ffmpeg-devel mailing list