]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/pmpdec.c
libfdk-aacdec: Always decode into an intermediate buffer
[ffmpeg] / libavformat / pmpdec.c
index 96c704857066915bf4adb7da59bfb7fa3583e6fa..8ae147f3919a1b02b6f606bd2e39c4b40d1e0168 100644 (file)
@@ -39,13 +39,13 @@ static int pmp_probe(AVProbeData *p)
     return 0;
 }
 
-static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
+static int pmp_header(AVFormatContext *s)
 {
     PMPContext *pmp = s->priv_data;
     AVIOContext *pb = s->pb;
     int tb_num, tb_den;
     int index_cnt;
-    int audio_codec_id = CODEC_ID_NONE;
+    int audio_codec_id = AV_CODEC_ID_NONE;
     int srate, channels;
     int i;
     uint64_t pos;
@@ -56,10 +56,10 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
     avio_skip(pb, 8);
     switch (avio_rl32(pb)) {
     case 0:
-        vst->codec->codec_id = CODEC_ID_MPEG4;
+        vst->codec->codec_id = AV_CODEC_ID_MPEG4;
         break;
     case 1:
-        vst->codec->codec_id = CODEC_ID_H264;
+        vst->codec->codec_id = AV_CODEC_ID_H264;
         break;
     default:
         av_log(s, AV_LOG_ERROR, "Unsupported video format\n");
@@ -77,11 +77,11 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
 
     switch (avio_rl32(pb)) {
     case 0:
-        audio_codec_id = CODEC_ID_MP3;
+        audio_codec_id = AV_CODEC_ID_MP3;
         break;
     case 1:
         av_log(s, AV_LOG_WARNING, "AAC is not yet correctly supported\n");
-        audio_codec_id = CODEC_ID_AAC;
+        audio_codec_id = AV_CODEC_ID_AAC;
         break;
     default:
         av_log(s, AV_LOG_ERROR, "Unsupported audio format\n");
@@ -124,6 +124,11 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
     if (pmp->cur_stream == 0) {
         int num_packets;
         pmp->audio_packets = avio_r8(pb);
+        if (!pmp->audio_packets) {
+            av_log(s, AV_LOG_ERROR, "No audio packets.\n");
+            return AVERROR_INVALIDDATA;
+        }
+
         num_packets = (pmp->num_streams - 1) * pmp->audio_packets + 1;
         avio_skip(pb, 8);
         pmp->current_packet = 0;
@@ -157,7 +162,7 @@ static int pmp_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
 {
     PMPContext *pmp = s->priv_data;
     pmp->cur_stream = 0;
-    // fallback to default seek now
+    // fall back on default seek now
     return -1;
 }
 
@@ -170,7 +175,7 @@ static int pmp_close(AVFormatContext *s)
 
 AVInputFormat ff_pmp_demuxer = {
     .name           = "pmp",
-    .long_name      = NULL_IF_CONFIG_SMALL("Playstation Portable PMP format"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Playstation Portable PMP"),
     .priv_data_size = sizeof(PMPContext),
     .read_probe     = pmp_probe,
     .read_header    = pmp_header,