]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/thp.c
rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
[ffmpeg] / libavformat / thp.c
index 25efcbba825ed388474c77f21780483cf81aca46..e8ca04f939e68f194f99af77f53dc4be65714692 100644 (file)
@@ -54,8 +54,7 @@ static int thp_probe(AVProbeData *p)
         return 0;
 }
 
-static int thp_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
+static int thp_read_header(AVFormatContext *s)
 {
     ThpDemuxContext *thp = s->priv_data;
     AVStream *st;
@@ -103,7 +102,7 @@ static int thp_read_header(AVFormatContext *s,
                is required.  */
             avpriv_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
             st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_THP;
+            st->codec->codec_id = AV_CODEC_ID_THP;
             st->codec->codec_tag = 0;  /* no fourcc */
             st->codec->width = avio_rb32(pb);
             st->codec->height = avio_rb32(pb);
@@ -123,7 +122,7 @@ static int thp_read_header(AVFormatContext *s,
                 return AVERROR(ENOMEM);
 
             st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_id = CODEC_ID_ADPCM_THP;
+            st->codec->codec_id = AV_CODEC_ID_ADPCM_THP;
             st->codec->codec_tag = 0;  /* no fourcc */
             st->codec->channels    = avio_rb32(pb); /* numChannels.  */
             st->codec->sample_rate = avio_rb32(pb); /* Frequency.  */
@@ -182,6 +181,9 @@ static int thp_read_packet(AVFormatContext *s,
         }
 
         pkt->stream_index = thp->audio_stream_index;
+        if (thp->audiosize >= 8)
+            pkt->duration = AV_RB32(&pkt->data[4]);
+
         thp->audiosize = 0;
         thp->frame++;
     }