summaryrefslogtreecommitdiff
path: root/libavformat/cdg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-09 21:29:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-09 21:30:45 +0200
commit714d9bd6ee2fff97ed14ccf1fc02f031afccce3c (patch)
tree7cbb3b97509253e64d4a5b7a1a7bcff74a36c4fc /libavformat/cdg.c
parent76a35f7830d1bd05ce9cdd63a48d5beb9f79ef7c (diff)
parentabda15a990527557c20848f6ca2f82eb85e76dc9 (diff)
Merge commit 'abda15a990527557c20848f6ca2f82eb85e76dc9'
* commit 'abda15a990527557c20848f6ca2f82eb85e76dc9': cdg: set the keyframe flag on the first packet Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/cdg.c')
-rw-r--r--libavformat/cdg.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 2d40d3dc55..b2bc2cd6a1 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -26,6 +26,10 @@
#define CDG_COMMAND 0x09
#define CDG_MASK 0x3F
+typedef struct CDGContext {
+ int got_first_packet;
+} CDGContext;
+
static int read_header(AVFormatContext *s)
{
AVStream *vst;
@@ -50,6 +54,7 @@ static int read_header(AVFormatContext *s)
static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
+ CDGContext *priv = s->priv_data;
int ret;
while (1) {
@@ -59,6 +64,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
av_free_packet(pkt);
}
+ if (!priv->got_first_packet) {
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ priv->got_first_packet = 1;
+ }
+
pkt->stream_index = 0;
pkt->dts=
pkt->pts= pkt->pos / CDG_PACKET_SIZE;
@@ -72,6 +82,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_cdg_demuxer = {
.name = "cdg",
.long_name = NULL_IF_CONFIG_SMALL("CD Graphics"),
+ .priv_data_size = sizeof(CDGContext),
.read_header = read_header,
.read_packet = read_packet,
.flags = AVFMT_GENERIC_INDEX,