]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/oggparseogm.c
get_bits/put_bits: K&R formatting cosmetics
[ffmpeg] / libavformat / oggparseogm.c
index 25722f3b0e1f935217c758d364ab7048f94d9260..7b3cda221ef587f63e2231eed8b134ee532e748e 100644 (file)
@@ -27,6 +27,7 @@
 #include "libavcodec/get_bits.h"
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
+#include "internal.h"
 #include "oggdec.h"
 #include "riff.h"
 
@@ -39,7 +40,6 @@ ogm_header(AVFormatContext *s, int idx)
     const uint8_t *p = os->buf + os->pstart;
     uint64_t time_unit;
     uint64_t spu;
-    uint32_t default_len;
 
     if(!(*p & 1))
         return 0;
@@ -56,7 +56,7 @@ ogm_header(AVFormatContext *s, int idx)
             st->codec->codec_tag = tag;
         } else if (*p == 't') {
             st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-            st->codec->codec_id = CODEC_ID_TEXT;
+            st->codec->codec_id = AV_CODEC_ID_TEXT;
             p += 12;
         } else {
             uint8_t acid[5];
@@ -74,23 +74,19 @@ ogm_header(AVFormatContext *s, int idx)
 
         time_unit   = bytestream_get_le64(&p);
         spu         = bytestream_get_le64(&p);
-        default_len = bytestream_get_le32(&p);
-
+        p += 4;                     /* default_len */
         p += 8;                     /* buffersize + bits_per_sample */
 
         if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
             st->codec->width = bytestream_get_le32(&p);
             st->codec->height = bytestream_get_le32(&p);
-            st->codec->time_base.den = spu * 10000000;
-            st->codec->time_base.num = time_unit;
-            st->time_base = st->codec->time_base;
+            avpriv_set_pts_info(st, 64, time_unit, spu * 10000000);
         } else {
             st->codec->channels = bytestream_get_le16(&p);
             p += 2;                 /* block_align */
             st->codec->bit_rate = bytestream_get_le32(&p) * 8;
             st->codec->sample_rate = spu * 10000000 / time_unit;
-            st->time_base.num = 1;
-            st->time_base.den = st->codec->sample_rate;
+            avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
         }
     } else if (*p == 3) {
         if (os->psize > 8)
@@ -119,8 +115,7 @@ ogm_dshow_header(AVFormatContext *s, int idx)
     if(t == 0x05589f80){
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
         st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, AV_RL32(p + 68));
-        st->codec->time_base.den = 10000000;
-        st->codec->time_base.num = AV_RL64(p + 164);
+        avpriv_set_pts_info(st, 64, AV_RL64(p + 164), 10000000);
         st->codec->width = AV_RL32(p + 176);
         st->codec->height = AV_RL32(p + 180);
     } else if(t == 0x05589f81){
@@ -143,7 +138,7 @@ ogm_packet(AVFormatContext *s, int idx)
     int lb;
 
     if(*p & 8)
-        os->pflags |= PKT_FLAG_KEY;
+        os->pflags |= AV_PKT_FLAG_KEY;
 
     lb = ((*p & 2) << 1) | ((*p >> 6) & 3);
     os->pstart += lb + 1;
@@ -161,6 +156,7 @@ const struct ogg_codec ff_ogm_video_codec = {
     .header = ogm_header,
     .packet = ogm_packet,
     .granule_is_start = 1,
+    .nb_header = 2,
 };
 
 const struct ogg_codec ff_ogm_audio_codec = {
@@ -169,6 +165,7 @@ const struct ogg_codec ff_ogm_audio_codec = {
     .header = ogm_header,
     .packet = ogm_packet,
     .granule_is_start = 1,
+    .nb_header = 2,
 };
 
 const struct ogg_codec ff_ogm_text_codec = {
@@ -177,6 +174,7 @@ const struct ogg_codec ff_ogm_text_codec = {
     .header = ogm_header,
     .packet = ogm_packet,
     .granule_is_start = 1,
+    .nb_header = 2,
 };
 
 const struct ogg_codec ff_ogm_old_codec = {
@@ -185,4 +183,5 @@ const struct ogg_codec ff_ogm_old_codec = {
     .header = ogm_dshow_header,
     .packet = ogm_packet,
     .granule_is_start = 1,
+    .nb_header = 1,
 };