rawdec: don't set codec timebase.
[libav.git] / libavformat / rawdec.c
index 9b3ef49..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;
@@ -170,7 +171,7 @@ fail:
 #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 const AVOption ff_rawvideo_options[] = {
-    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC},
+    { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC},
     { NULL },
 };
 
@@ -186,18 +187,6 @@ AVInputFormat ff_g722_demuxer = {
 };
 #endif
 
-#if CONFIG_GSM_DEMUXER
-AVInputFormat ff_gsm_demuxer = {
-    .name           = "gsm",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw GSM"),
-    .read_header    = ff_raw_audio_read_header,
-    .read_packet    = ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "gsm",
-    .value = CODEC_ID_GSM,
-};
-#endif
-
 #if CONFIG_LATM_DEMUXER
 AVInputFormat ff_latm_demuxer = {
     .name           = "latm",
@@ -244,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,
 };