diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-14 03:43:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-14 03:48:22 +0200 |
commit | 91eb1b1525456efecc3154ca533b943d2916886e (patch) | |
tree | 34eb85a4cd6dbc0badfddc3da33038798da9d40a /libavformat | |
parent | 90705aabe1a0b947d25f2a1d5fcbad85cfdfbc2c (diff) | |
parent | a62d36697d3cefc705736d21fcaede425147b5f0 (diff) | |
download | ffmpeg-91eb1b1525456efecc3154ca533b943d2916886e.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
prores: add FATE tests
id3v2: reduce the scope of some non-globally-used symbols/structures
id3v2: cosmetics: move some declarations before the places they are used
shorten: remove the flush function.
shn: do not allow seeking in the raw shn demuxer.
avformat: add AVInputFormat flag AVFMT_NO_BYTE_SEEK.
avformat: update AVInputFormat allowed flags
avformat: don't unconditionally call ff_read_frame_flush() when trying to seek.
truespeech: use sizeof() instead of hardcoded sizes
truespeech: remove unneeded variable, 'consumed'
truespeech: simplify truespeech_read_frame() by using get_bits()
truespeech: decode directly to output buffer instead of a temp buffer
truespeech: check to make sure channels == 1
truespeech: check for large enough output buffer rather than truncating output
truespeech: remove unneeded zero-size packet check.
mlpdec: return meaningful error codes instead of -1
mlpdec: remove unnecessary wrapper function
mlpdec: only calculate output size once
mlpdec: validate that the reported channel count matches the actual output channel count
pcm: reduce pointer type casting
...
Conflicts:
libavformat/avformat.h
libavformat/id3v2.c
libavformat/id3v2.h
libavformat/utils.c
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avformat.h | 11 | ||||
-rw-r--r-- | libavformat/id3v2.c | 150 | ||||
-rw-r--r-- | libavformat/id3v2.h | 10 | ||||
-rw-r--r-- | libavformat/rawdec.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 26 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
6 files changed, 103 insertions, 98 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index c785a13ea7..49fe08ec60 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -274,9 +274,10 @@ typedef struct AVFormatParameters { #define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ #define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */ #define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ -#define AVFMT_TS_NONSTRICT 0x8000 /**< Format does not require strictly - increasing timestamps, but they must - still be monotonic */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_TS_NONSTRICT 0x8000000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ typedef struct AVOutputFormat { const char *name; @@ -411,7 +412,9 @@ typedef struct AVInputFormat { int64_t *pos, int64_t pos_limit); /** - * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK. */ int flags; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 22a2df79e0..32870648cf 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -33,6 +33,66 @@ #include "libavutil/dict.h" #include "avio_internal.h" +const AVMetadataConv ff_id3v2_34_metadata_conv[] = { + { "TALB", "album"}, + { "TCOM", "composer"}, + { "TCON", "genre"}, + { "TCOP", "copyright"}, + { "TENC", "encoded_by"}, + { "TIT2", "title"}, + { "TLAN", "language"}, + { "TPE1", "artist"}, + { "TPE2", "album_artist"}, + { "TPE3", "performer"}, + { "TPOS", "disc"}, + { "TPUB", "publisher"}, + { "TRCK", "track"}, + { "TSSE", "encoder"}, + { 0 } +}; + +const AVMetadataConv ff_id3v2_4_metadata_conv[] = { + { "TDRL", "date"}, + { "TDRC", "date"}, + { "TDEN", "creation_time"}, + { "TSOA", "album-sort"}, + { "TSOP", "artist-sort"}, + { "TSOT", "title-sort"}, + { 0 } +}; + +static const AVMetadataConv id3v2_2_metadata_conv[] = { + { "TAL", "album"}, + { "TCO", "genre"}, + { "TT2", "title"}, + { "TEN", "encoded_by"}, + { "TP1", "artist"}, + { "TP2", "album_artist"}, + { "TP3", "performer"}, + { "TRK", "track"}, + { 0 } +}; + + +const char ff_id3v2_tags[][4] = { + "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDLY", "TENC", "TEXT", + "TFLT", "TIT1", "TIT2", "TIT3", "TKEY", "TLAN", "TLEN", "TMED", + "TOAL", "TOFN", "TOLY", "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", + "TPE4", "TPOS", "TPUB", "TRCK", "TRSN", "TRSO", "TSRC", "TSSE", + { 0 }, +}; + +const char ff_id3v2_4_tags[][4] = { + "TDEN", "TDOR", "TDRC", "TDRL", "TDTG", "TIPL", "TMCL", "TMOO", + "TPRO", "TSOA", "TSOP", "TSOT", "TSST", + { 0 }, +}; + +const char ff_id3v2_3_tags[][4] = { + "TDAT", "TIME", "TORY", "TRDA", "TSIZ", "TYER", + { 0 }, +}; + int ff_id3v2_match(const uint8_t *buf, const char * magic) { return buf[0] == magic[0] && @@ -328,6 +388,18 @@ finish: av_dict_set(m, "date", date, 0); } +typedef struct ID3v2EMFunc { + const char *tag3; + const char *tag4; + void (*read)(AVFormatContext*, AVIOContext*, int, char*, ID3v2ExtraMeta **); + void (*free)(void *); +} ID3v2EMFunc; + +static const ID3v2EMFunc id3v2_extra_meta_funcs[] = { + { "GEO", "GEOB", read_geobtag, free_geobtag }, + { NULL } +}; + /** * Get the corresponding ID3v2EMFunc struct for a tag. * @param isv34 Determines if v2.2 or v2.3/4 strings are used @@ -336,16 +408,15 @@ finish: static const ID3v2EMFunc *get_extra_meta_func(const char *tag, int isv34) { int i = 0; - while (ff_id3v2_extra_meta_funcs[i].tag3) { + while (id3v2_extra_meta_funcs[i].tag3) { if (!memcmp(tag, - (isv34 ? - ff_id3v2_extra_meta_funcs[i].tag4 : - ff_id3v2_extra_meta_funcs[i].tag3), + (isv34 ? id3v2_extra_meta_funcs[i].tag4 : + id3v2_extra_meta_funcs[i].tag3), (isv34 ? 4 : 3))) - return &ff_id3v2_extra_meta_funcs[i]; + return &id3v2_extra_meta_funcs[i]; i++; } - return &ff_id3v2_extra_meta_funcs[i]; + return &id3v2_extra_meta_funcs[i]; } static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags, ID3v2ExtraMeta **extra_meta) @@ -508,7 +579,7 @@ void ff_id3v2_read_all(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **e } } while (found_header); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv); - ff_metadata_conv(&s->metadata, NULL, ff_id3v2_2_metadata_conv); + ff_metadata_conv(&s->metadata, NULL, id3v2_2_metadata_conv); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_4_metadata_conv); merge_date(&s->metadata); } @@ -531,68 +602,3 @@ void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta) current = next; } } - -const ID3v2EMFunc ff_id3v2_extra_meta_funcs[] = { - { "GEO", "GEOB", read_geobtag, free_geobtag }, - { NULL, NULL, NULL, NULL } -}; - -const AVMetadataConv ff_id3v2_34_metadata_conv[] = { - { "TALB", "album"}, - { "TCOM", "composer"}, - { "TCON", "genre"}, - { "TCOP", "copyright"}, - { "TENC", "encoded_by"}, - { "TIT2", "title"}, - { "TLAN", "language"}, - { "TPE1", "artist"}, - { "TPE2", "album_artist"}, - { "TPE3", "performer"}, - { "TPOS", "disc"}, - { "TPUB", "publisher"}, - { "TRCK", "track"}, - { "TSSE", "encoder"}, - { 0 } -}; - -const AVMetadataConv ff_id3v2_4_metadata_conv[] = { - { "TDRL", "date"}, - { "TDRC", "date"}, - { "TDEN", "creation_time"}, - { "TSOA", "album-sort"}, - { "TSOP", "artist-sort"}, - { "TSOT", "title-sort"}, - { 0 } -}; - -const AVMetadataConv ff_id3v2_2_metadata_conv[] = { - { "TAL", "album"}, - { "TCO", "genre"}, - { "TT2", "title"}, - { "TEN", "encoded_by"}, - { "TP1", "artist"}, - { "TP2", "album_artist"}, - { "TP3", "performer"}, - { "TRK", "track"}, - { 0 } -}; - - -const char ff_id3v2_tags[][4] = { - "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDLY", "TENC", "TEXT", - "TFLT", "TIT1", "TIT2", "TIT3", "TKEY", "TLAN", "TLEN", "TMED", - "TOAL", "TOFN", "TOLY", "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", - "TPE4", "TPOS", "TPUB", "TRCK", "TRSN", "TRSO", "TSRC", "TSSE", - { 0 }, -}; - -const char ff_id3v2_4_tags[][4] = { - "TDEN", "TDOR", "TDRC", "TDRL", "TDTG", "TIPL", "TMCL", "TMOO", - "TPRO", "TSOA", "TSOP", "TSOT", "TSST", - { 0 }, -}; - -const char ff_id3v2_3_tags[][4] = { - "TDAT", "TIME", "TORY", "TRDA", "TSIZ", "TYER", - { 0 }, -}; diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h index 76c00d108e..58cacdfeda 100644 --- a/libavformat/id3v2.h +++ b/libavformat/id3v2.h @@ -59,13 +59,6 @@ typedef struct ID3v2ExtraMetaGEOB { uint8_t *data; } ID3v2ExtraMetaGEOB; -typedef struct ID3v2EMFunc { - const char *tag3; - const char *tag4; - void (*read)(AVFormatContext*, AVIOContext*, int, char*, ID3v2ExtraMeta **); - void (*free)(void *); -} ID3v2EMFunc; - /** * Detect ID3v2 Header. * @param buf must be ID3v2_HEADER_SIZE byte long @@ -99,11 +92,8 @@ void ff_id3v2_read_all(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **e */ void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta); -extern const ID3v2EMFunc ff_id3v2_extra_meta_funcs[]; - extern const AVMetadataConv ff_id3v2_34_metadata_conv[]; extern const AVMetadataConv ff_id3v2_4_metadata_conv[]; -extern const AVMetadataConv ff_id3v2_2_metadata_conv[]; /** * A list of text information frames allowed in both ID3 v2.3 and v2.4 diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index c3be73cf77..7726f02708 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -245,7 +245,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, }; diff --git a/libavformat/utils.c b/libavformat/utils.c index 58982955de..c7eb93f3b0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1808,10 +1808,12 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f int ret; AVStream *st; - ff_read_frame_flush(s); - - if(flags & AVSEEK_FLAG_BYTE) + if (flags & AVSEEK_FLAG_BYTE) { + if (s->iformat->flags & AVFMT_NO_BYTE_SEEK) + return -1; + ff_read_frame_flush(s); return seek_frame_byte(s, stream_index, timestamp, flags); + } if(stream_index < 0){ stream_index= av_find_default_stream_index(s); @@ -1825,19 +1827,23 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f /* first, we try the format specific seek */ AV_NOWARN_DEPRECATED( - if (s->iformat->read_seek) + if (s->iformat->read_seek) { + ff_read_frame_flush(s); ret = s->iformat->read_seek(s, stream_index, timestamp, flags); - else + } else ret = -1; ) if (ret >= 0) { return 0; } - if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) + if (s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) { + ff_read_frame_flush(s); return av_seek_frame_binary(s, stream_index, timestamp, flags); - else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) + } else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) { + ff_read_frame_flush(s); return seek_frame_generic(s, stream_index, timestamp, flags); + } else return -1; } @@ -1847,10 +1853,10 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int if(min_ts > ts || max_ts < ts) return -1; - ff_read_frame_flush(s); - - if (s->iformat->read_seek2) + if (s->iformat->read_seek2) { + ff_read_frame_flush(s); return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags); + } if(s->iformat->read_timestamp){ //try to seek via read_timestamp() diff --git a/libavformat/version.h b/libavformat/version.h index d2f9786a0d..fc27815f41 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 53 -#define LIBAVFORMAT_VERSION_MINOR 15 +#define LIBAVFORMAT_VERSION_MINOR 16 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |