]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/paf.c
Merge commit 'f154ef1ae5b03f288dd8c025dab1884b4cb20c1a'
[ffmpeg] / libavformat / paf.c
index 5261ecf1ef26b244a2b5bc6a6cdc59908e8e5378..8fe2ac56382c5eb0e143423e27a91982ff61725f 100644 (file)
@@ -107,7 +107,7 @@ static int read_header(AVFormatContext *s)
     avio_skip(pb, 4);
     vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     vst->codec->codec_tag  = 0;
-    vst->codec->codec_id   = CODEC_ID_PAF_VIDEO;
+    vst->codec->codec_id   = AV_CODEC_ID_PAF_VIDEO;
     avpriv_set_pts_info(vst, 64, 1, 10);
 
     ast = avformat_new_stream(s, 0);
@@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s)
     ast->start_time         = 0;
     ast->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
     ast->codec->codec_tag   = 0;
-    ast->codec->codec_id    = CODEC_ID_PAF_AUDIO;
+    ast->codec->codec_id    = AV_CODEC_ID_PAF_AUDIO;
     ast->codec->channels    = 2;
     ast->codec->sample_rate = 22050;
     avpriv_set_pts_info(ast, 64, 1, 22050);
@@ -200,7 +200,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
             return AVERROR(ENOMEM);
 
         memcpy(pkt->data, p->temp_audio_frame, p->audio_size);
-        pkt->duration     = PAF_SOUND_SAMPLES * p->audio_size / PAF_SOUND_FRAME_SIZE;
+        pkt->duration     = PAF_SOUND_SAMPLES * (p->audio_size / PAF_SOUND_FRAME_SIZE);
         pkt->flags       |= AV_PKT_FLAG_KEY;
         pkt->stream_index = 1;
         p->got_audio      = 0;
@@ -232,7 +232,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     size = p->video_size - p->frames_offset_table[p->current_frame];
-    if (size < 0)
+    if (size < 1)
         return AVERROR_INVALIDDATA;
 
     if (av_new_packet(pkt, size) < 0)
@@ -241,6 +241,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->stream_index = 0;
     pkt->duration     = 1;
     memcpy(pkt->data, p->video_frame + p->frames_offset_table[p->current_frame], size);
+    if (pkt->data[0] & 0x20)
+        pkt->flags   |= AV_PKT_FLAG_KEY;
     p->current_frame++;
 
     return pkt->size;