]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/oma.c
avconv: make timer_start a local var in transcode().
[ffmpeg] / libavformat / oma.c
index a47fde02f98672e82885964d68a35ac345fcf32f..7675841792b81e9a243bc20a5866f20b6cb66900 100644 (file)
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Maxim Poliakovski
  *               2008 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav 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.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav 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 FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -45,7 +45,7 @@
 
 #include "avformat.h"
 #include "libavutil/intreadwrite.h"
-#include "raw.h"
+#include "pcm.h"
 #include "riff.h"
 #include "id3v2.h"
 
@@ -79,7 +79,9 @@ static int oma_read_header(AVFormatContext *s,
     AVStream *st;
 
     ff_id3v2_read(s, ID3v2_EA3_MAGIC);
-    ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
+    ret = avio_read(s->pb, buf, EA3_HEADER_SIZE);
+    if (ret < EA3_HEADER_SIZE)
+        return -1;
 
     if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
         av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
@@ -107,7 +109,8 @@ static int oma_read_header(AVFormatContext *s,
         case OMA_CODECID_ATRAC3:
             samplerate = srate_tab[(codec_params >> 13) & 7]*100;
             if (samplerate != 44100)
-                av_log(s, AV_LOG_ERROR, "Unsupported sample rate, send sample file to developers: %d\n", samplerate);
+                av_log_ask_for_sample(s, "Unsupported sample rate: %d\n",
+                                      samplerate);
 
             framesize = (codec_params & 0x3FF) * 8;
             jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 for joint-stereo */
@@ -146,7 +149,6 @@ static int oma_read_header(AVFormatContext *s,
         default:
             av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n",buf[32]);
             return -1;
-            break;
     }
 
     st->codec->block_align = framesize;
@@ -189,18 +191,15 @@ static int oma_read_probe(AVProbeData *p)
 }
 
 
-AVInputFormat oma_demuxer = {
-    "oma",
-    NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
-    0,
-    oma_read_probe,
-    oma_read_header,
-    oma_read_packet,
-    0,
-    pcm_read_seek,
+AVInputFormat ff_oma_demuxer = {
+    .name           = "oma",
+    .long_name      = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
+    .read_probe     = oma_read_probe,
+    .read_header    = oma_read_header,
+    .read_packet    = oma_read_packet,
+    .read_seek      = pcm_read_seek,
     .flags= AVFMT_GENERIC_INDEX,
     .extensions = "oma,aa3",
     .codec_tag= (const AVCodecTag* const []){codec_oma_tags, 0},
-    .metadata_conv = ff_id3v2_metadata_conv,
 };