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

Michael Tison blackspike
Wed Dec 16 04:56:33 CET 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdgraphicsv9.patch
Type: text/x-diff
Size: 18458 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091215/7f0c0dc3/attachment.patch>



More information about the ffmpeg-devel mailing list