rawdec: don't set codec timebase.
[libav.git] / libavformat / rawdec.c
index 0b9a082..589cdd5 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include "avformat.h"
+#include "internal.h"
 #include "avio_internal.h"
 #include "rawdec.h"
 #include "libavutil/opt.h"
@@ -33,7 +34,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
     AVStream *st;
     enum CodecID id;
 
-    st = av_new_stream(s, 0);
+    st = avformat_new_stream(s, NULL);
     if (!st)
         return AVERROR(ENOMEM);
 
@@ -62,7 +63,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
             st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
             assert(st->codec->bits_per_coded_sample > 0);
             st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+            avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
             break;
             }
         case AVMEDIA_TYPE_VIDEO: {
@@ -84,7 +85,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
                 goto fail;
             }
-            av_set_pts_info(st, 64, framerate.den, framerate.num);
+            avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
             st->codec->width  = width;
             st->codec->height = height;
             st->codec->pix_fmt = pix_fmt;
@@ -122,7 +123,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
 int ff_raw_audio_read_header(AVFormatContext *s,
                              AVFormatParameters *ap)
 {
-    AVStream *st = av_new_stream(s, 0);
+    AVStream *st = avformat_new_stream(s, NULL);
     if (!st)
         return AVERROR(ENOMEM);
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -143,7 +144,7 @@ int ff_raw_video_read_header(AVFormatContext *s,
     int ret = 0;
 
 
-    st = av_new_stream(s, 0);
+    st = avformat_new_stream(s, NULL);
     if (!st) {
         ret = AVERROR(ENOMEM);
         goto fail;
@@ -158,8 +159,8 @@ int ff_raw_video_read_header(AVFormatContext *s,
         goto fail;
     }
 
-    st->codec->time_base = (AVRational){framerate.den, framerate.num};
-    av_set_pts_info(st, 64, 1, 1200000);
+    st->r_frame_rate = st->avg_frame_rate = framerate;
+    avpriv_set_pts_info(st, 64, 1, 1200000);
 
 fail:
     return ret;
@@ -169,21 +170,10 @@ fail:
 
 #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
-static const AVOption video_options[] = {
-    { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
-    { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC },
-    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
+const AVOption ff_rawvideo_options[] = {
+    { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC},
     { NULL },
 };
-#undef OFFSET
-#undef DEC
-
-const AVClass ff_rawvideo_demuxer_class = {
-    .class_name     = "rawvideo demuxer",
-    .item_name      = av_default_item_name,
-    .option         = video_options,
-    .version        = LIBAVUTIL_VERSION_INT,
-};
 
 #if CONFIG_G722_DEMUXER
 AVInputFormat ff_g722_demuxer = {
@@ -197,15 +187,15 @@ AVInputFormat ff_g722_demuxer = {
 };
 #endif
 
-#if CONFIG_GSM_DEMUXER
-AVInputFormat ff_gsm_demuxer = {
-    .name           = "gsm",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw GSM"),
+#if CONFIG_LATM_DEMUXER
+AVInputFormat ff_latm_demuxer = {
+    .name           = "latm",
+    .long_name      = NULL_IF_CONFIG_SMALL("raw LOAS/LATM"),
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "gsm",
-    .value = CODEC_ID_GSM,
+    .extensions = "latm",
+    .value = CODEC_ID_AAC_LATM,
 };
 #endif
 
@@ -243,7 +233,7 @@ AVInputFormat ff_shorten_demuxer = {
     .long_name      = NULL_IF_CONFIG_SMALL("raw Shorten"),
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
+    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
     .extensions = "shn",
     .value = CODEC_ID_SHORTEN,
 };