]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/oggparseogm.c
optimize ac3_downmix.
[ffmpeg] / libavformat / oggparseogm.c
index aee47aba87db23edb5a7383bc7cb83d84e7c7158..af1e4cfaaa5dd7d303bca1241d7f679decd886ba 100644 (file)
 **/
 
 #include <stdlib.h>
+#include "libavutil/intreadwrite.h"
+#include "libavcodec/bitstream.h"
+#include "libavcodec/bytestream.h"
 #include "avformat.h"
-#include "bitstream.h"
-#include "bytestream.h"
-#include "intreadwrite.h"
-#include "ogg2.h"
+#include "oggdec.h"
 #include "riff.h"
 
 static int
@@ -36,7 +36,7 @@ ogm_header(AVFormatContext *s, int idx)
     ogg_t *ogg = s->priv_data;
     ogg_stream_t *os = ogg->streams + idx;
     AVStream *st = s->streams[idx];
-    uint8_t *p = os->buf + os->pstart;
+    const uint8_t *p = os->buf + os->pstart;
     uint64_t time_unit;
     uint64_t spu;
     uint32_t default_len;
@@ -55,6 +55,10 @@ ogm_header(AVFormatContext *s, int idx)
         tag = bytestream_get_le32(&p);
         st->codec->codec_id = codec_get_id(codec_bmp_tags, tag);
         st->codec->codec_tag = tag;
+    } else if (*p == 't') {
+        st->codec->codec_type = CODEC_TYPE_SUBTITLE;
+        st->codec->codec_id = CODEC_ID_TEXT;
+        p += 12;
     } else {
         uint8_t acid[5];
         int cid;
@@ -64,6 +68,7 @@ ogm_header(AVFormatContext *s, int idx)
         acid[4] = 0;
         cid = strtol(acid, NULL, 16);
         st->codec->codec_id = codec_get_id(codec_wav_tags, cid);
+        st->need_parsing = AVSTREAM_PARSE_FULL;
     }
 
     p += 4;                     /* useless size field */
@@ -134,6 +139,9 @@ ogm_packet(AVFormatContext *s, int idx)
     uint8_t *p = os->buf + os->pstart;
     int lb;
 
+    if(*p & 8)
+        os->pflags |= PKT_FLAG_KEY;
+
     lb = ((*p & 2) << 1) | ((*p >> 6) & 3);
     os->pstart += lb + 1;
     os->psize -= lb + 1;
@@ -155,6 +163,13 @@ ogg_codec_t ogm_audio_codec = {
     .packet = ogm_packet
 };
 
+ogg_codec_t ogm_text_codec = {
+    .magic = "\001text",
+    .magicsize = 5,
+    .header = ogm_header,
+    .packet = ogm_packet
+};
+
 ogg_codec_t ogm_old_codec = {
     .magic = "\001Direct Show Samples embedded in Ogg",
     .magicsize = 35,