diff options
Diffstat (limited to 'libavformat/cdg.c')
-rw-r--r-- | libavformat/cdg.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libavformat/cdg.c b/libavformat/cdg.c index 3f11286..05cac6e 100644 --- a/libavformat/cdg.c +++ b/libavformat/cdg.c @@ -2,20 +2,20 @@ * CD Graphics Demuxer * Copyright (c) 2009 Michael Tison * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -46,10 +46,11 @@ static int read_header(AVFormatContext *s) avpriv_set_pts_info(vst, 32, 1, 300); ret = avio_size(s->pb); - if (ret < 0) - return ret; + if (ret < 0) { + av_log(s, AV_LOG_WARNING, "Cannot calculate duration as file size cannot be determined\n"); + } else + vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300); - vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300); return 0; } @@ -71,6 +72,12 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } pkt->stream_index = 0; + pkt->dts= + pkt->pts= pkt->pos / CDG_PACKET_SIZE; + + if(ret>5 && (pkt->data[0]&0x3F) == 9 && (pkt->data[1]&0x3F)==1 && !(pkt->data[2+2+1] & 0x0F)){ + pkt->flags = AV_PKT_FLAG_KEY; + } return ret; } @@ -80,5 +87,6 @@ AVInputFormat ff_cdg_demuxer = { .priv_data_size = sizeof(CDGContext), .read_header = read_header, .read_packet = read_packet, + .flags = AVFMT_GENERIC_INDEX, .extensions = "cdg", }; |