X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Foggparseogm.c;h=af1e4cfaaa5dd7d303bca1241d7f679decd886ba;hb=58c37c30b4e23c3bac2d85ffd448a3192fa2fc1e;hp=edafd652899356c3a36b8ee93a309acf72047683;hpb=a0ddef24ced504abeaccb4d23e051831a0998298;p=ffmpeg diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c index edafd652899..af1e4cfaaa5 100644 --- a/libavformat/oggparseogm.c +++ b/libavformat/oggparseogm.c @@ -23,10 +23,10 @@ **/ #include +#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 "oggdec.h" #include "riff.h" @@ -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,