From 19341c58e0f7210046286e08ae5f955a14ee3e3f Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 9 Dec 2011 11:06:02 +0100 Subject: Dxtory capture format decoder Signed-off-by: Anton Khirnov --- libavformat/riff.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libavformat') diff --git a/libavformat/riff.c b/libavformat/riff.c index 1161e975e9..db3f9584ed 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -280,6 +280,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') }, { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') }, { CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') }, + { CODEC_ID_DXTORY, MKTAG('x', 't', 'o', 'r') }, { CODEC_ID_NONE, 0 } }; -- cgit v1.2.3 From 28101f6c4eb341fca0c3f7e237f8236b0fde9530 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 9 Dec 2011 22:51:30 -0500 Subject: flac muxer: fix writing of file header and STREAMINFO header from extradata fixes Bug 119 --- libavformat/flacenc_header.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'libavformat') diff --git a/libavformat/flacenc_header.c b/libavformat/flacenc_header.c index ad8d55b380..c1f7c86554 100644 --- a/libavformat/flacenc_header.c +++ b/libavformat/flacenc_header.c @@ -37,13 +37,11 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, if (!avpriv_flac_is_extradata_valid(codec, &format, &streaminfo)) return -1; - /* write "fLaC" stream marker and first metadata block header if needed */ - if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) { - avio_write(pb, header, 8); - } + /* write "fLaC" stream marker and first metadata block header */ + avio_write(pb, header, 8); - /* write STREAMINFO or full header */ - avio_write(pb, codec->extradata, codec->extradata_size); + /* write STREAMINFO */ + avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); return 0; } -- cgit v1.2.3 From 3c1f60860da70e074c54bbbbe720474688eaafe9 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sat, 10 Dec 2011 04:53:30 +0000 Subject: flacdec: Support for tracks in cuesheet metadata block Signed-off-by: Justin Ruggles --- libavformat/flacdec.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libavformat') diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index c5a6ac9b43..f3831c19ba 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -25,6 +25,7 @@ #include "rawdec.h" #include "oggdec.h" #include "vorbiscomment.h" +#include "libavcodec/bytestream.h" static int flac_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -54,6 +55,7 @@ static int flac_read_header(AVFormatContext *s, switch (metadata_type) { /* allocate and read metadata block for supported types */ case FLAC_METADATA_TYPE_STREAMINFO: + case FLAC_METADATA_TYPE_CUESHEET: case FLAC_METADATA_TYPE_VORBIS_COMMENT: buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!buffer) { @@ -96,6 +98,31 @@ static int flac_read_header(AVFormatContext *s, if (si.samples > 0) st->duration = si.samples; } + } else if (metadata_type == FLAC_METADATA_TYPE_CUESHEET) { + uint8_t isrc[13]; + uint64_t start; + const uint8_t *offset; + int i, j, chapters, track, ti; + if (metadata_size < 431) + return AVERROR_INVALIDDATA; + offset = buffer + 395; + chapters = bytestream_get_byte(&offset) - 1; + if (chapters <= 0) + return AVERROR_INVALIDDATA; + for (i = 0; i < chapters; i++) { + if (offset + 36 - buffer > metadata_size) + return AVERROR_INVALIDDATA; + start = bytestream_get_be64(&offset); + track = bytestream_get_byte(&offset); + bytestream_get_buffer(&offset, isrc, 12); + isrc[12] = 0; + offset += 14; + ti = bytestream_get_byte(&offset); + if (ti <= 0) return AVERROR_INVALIDDATA; + for (j = 0; j < ti; j++) + offset += 12; + avpriv_new_chapter(s, track, st->time_base, start, AV_NOPTS_VALUE, isrc); + } } else { /* STREAMINFO must be the first block */ if (!found_streaminfo) { -- cgit v1.2.3 From b262a05904bdb31862f0b2fc3c9e4aeee32d301c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 20:06:49 +0100 Subject: lavf doxy: add metadata docs to the main lavf group --- libavformat/avformat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libavformat') diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 5e00da12b2..16dc4e833a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -86,6 +86,7 @@ struct AVFormatContext; /** * @defgroup metadata_api Public Metadata API * @{ + * @ingroup libavf * The metadata API allows libavformat to export metadata tags to a client * application using a sequence of key/value pairs. Like all strings in Libav, * metadata must be stored as UTF-8 encoded Unicode. Note that metadata -- cgit v1.2.3 From e4f4a1f93e4573ac5e1ece6f667c807444a9a42c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 20:09:04 +0100 Subject: lavf doxy: rename lavf I/O group to lavf_io. --- libavformat/avformat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat') diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 16dc4e833a..2298d718c7 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -33,7 +33,7 @@ * @{ * @} * - * @defgroup lavf_proto I/O Read/Write + * @defgroup lavf_io I/O Read/Write * @{ * @} * -- cgit v1.2.3 From fb42db7c39f075baf59e53168a11a9feb2222761 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 20:11:28 +0100 Subject: lavf doxy: add avio groups into the lavf_io group. --- libavformat/avio.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libavformat') diff --git a/libavformat/avio.h b/libavformat/avio.h index d7977022bf..98880bae38 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -211,6 +211,7 @@ extern URLInterruptCB *url_interrupt_cb; * @defgroup old_url_funcs Old url_* functions * The following functions are deprecated. Use the buffered API based on #AVIOContext instead. * @{ + * @ingroup lavf_io */ attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up, const char *url, int flags); @@ -270,6 +271,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( * @defgroup old_avio_funcs Old put_/get_*() functions * The following functions are deprecated. Use the "avio_"-prefixed functions instead. * @{ + * @ingroup lavf_io */ attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); @@ -307,6 +309,7 @@ attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_in * @defgroup old_url_f_funcs Old url_f* functions * The following functions are deprecated, use the "avio_"-prefixed functions instead. * @{ + * @ingroup lavf_io */ attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); attribute_deprecated int url_fclose(AVIOContext *s); -- cgit v1.2.3 From eca06cbed9160a16f5e6c58302f1b9e2ff116283 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 20:16:57 +0100 Subject: lavf doxy: add installed headers to groups. --- libavformat/avformat.h | 6 ++++++ libavformat/avio.h | 1 + libavformat/version.h | 6 ++++++ 3 files changed, 13 insertions(+) (limited to 'libavformat') diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 2298d718c7..525f8ff3b5 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -21,6 +21,12 @@ #ifndef AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + /** * @defgroup libavf I/O and Muxing/Demuxing Library * @{ diff --git a/libavformat/avio.h b/libavformat/avio.h index 98880bae38..dec2a5effe 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -22,6 +22,7 @@ /** * @file + * @ingroup lavf_io * Buffered I/O operations */ diff --git a/libavformat/version.h b/libavformat/version.h index ba1254f63b..7ba411c494 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -21,6 +21,12 @@ #ifndef AVFORMAT_VERSION_H #define AVFORMAT_VERSION_H +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 53 -- cgit v1.2.3 From 28b4c06b9dde290ac5a5743edd0eb8f7b4296d1a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 20:39:39 +0100 Subject: lavf doxy: expand/reword metadata API doxy. --- libavformat/avformat.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libavformat') diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 525f8ff3b5..a0d8740566 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -94,9 +94,15 @@ struct AVFormatContext; * @{ * @ingroup libavf * The metadata API allows libavformat to export metadata tags to a client - * application using a sequence of key/value pairs. Like all strings in Libav, - * metadata must be stored as UTF-8 encoded Unicode. Note that metadata + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in Libav, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * * Important concepts to keep in mind: * - Keys are unique; there can never be 2 tags with the same key. This is * also meant semantically, i.e., a demuxer should not knowingly produce -- cgit v1.2.3 From 370f27dee34e9d26c2da1749d2ad31e690cdd61a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 21:04:30 +0100 Subject: lavf doxy: add demuxing stuff to lavf_decoding group --- libavformat/avformat.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'libavformat') diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a0d8740566..aeea779e9b 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -382,6 +382,10 @@ typedef struct AVOutputFormat { struct AVOutputFormat *next; } AVOutputFormat; +/** + * @addtogroup lavf_decoding + * @{ + */ typedef struct AVInputFormat { /** * A comma separated list of short names for the format. New names @@ -503,6 +507,9 @@ typedef struct AVInputFormat { /* private fields */ struct AVInputFormat *next; } AVInputFormat; +/** + * @} + */ enum AVStreamParseType { AVSTREAM_PARSE_NONE, @@ -1228,7 +1235,17 @@ enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int */ unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); -/* media file input */ +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * @addtogroup lavf_decoding + * @{ + */ /** * Find AVInputFormat based on the short name of the input format. @@ -1326,13 +1343,6 @@ attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char */ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); -/** - * Allocate an AVFormatContext. - * avformat_free_context() can be used to free the context and everything - * allocated by the framework within it. - */ -AVFormatContext *avformat_alloc_context(void); - #if FF_API_FORMAT_PARAMETERS /** * Read packets of a media file to get stream information. This @@ -1512,6 +1522,9 @@ void av_close_input_stream(AVFormatContext *s); * @param s media file handle */ void av_close_input_file(AVFormatContext *s); +/** + * @} + */ /** * Free an AVFormatContext and all its streams. -- cgit v1.2.3 From 489a7b07e9c4df1bea04a4d428a9c5a44c07f883 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 21:04:30 +0100 Subject: lavf doxy: add muxing stuff to lavf_encoding group --- libavformat/avformat.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'libavformat') diff --git a/libavformat/avformat.h b/libavformat/avformat.h index aeea779e9b..ab1cd3fcf1 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -323,6 +323,10 @@ typedef struct AVFormatParameters { #define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ #define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +/** + * @addtogroup lavf_encoding + * @{ + */ typedef struct AVOutputFormat { const char *name; /** @@ -381,6 +385,9 @@ typedef struct AVOutputFormat { /* private fields */ struct AVOutputFormat *next; } AVOutputFormat; +/** + * @} + */ /** * @addtogroup lavf_decoding @@ -1616,9 +1623,6 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); #endif -/** - * media file output - */ #if FF_API_FORMAT_PARAMETERS /** * @deprecated pass the options to avformat_write_header directly. @@ -1651,7 +1655,10 @@ void av_url_split(char *proto, int proto_size, int *port_ptr, char *path, int path_size, const char *url); - +/** + * @addtogroup lavf_encoding + * @{ + */ /** * Allocate the stream private data and write the stream header to * an output media file. @@ -1743,6 +1750,9 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, * @return 0 if OK, AVERROR_xxx on error */ int av_write_trailer(AVFormatContext *s); +/** + * @} + */ #if FF_API_DUMP_FORMAT attribute_deprecated void dump_format(AVFormatContext *ic, -- cgit v1.2.3 From e745d7525a21731a871318daff972608c1aeceec Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 10 Dec 2011 12:40:05 +0100 Subject: rawdec: don't set codec timebase. It's not supposed to be set outside of lavc. Set r_frame_rate and avg_frame_rate instead. --- libavformat/rawdec.c | 2 +- tests/ref/fate/h264-lossless | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'libavformat') diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 81dd8b49e5..589cdd5db9 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -159,7 +159,7 @@ int ff_raw_video_read_header(AVFormatContext *s, goto fail; } - st->codec->time_base = (AVRational){framerate.den, framerate.num}; + st->r_frame_rate = st->avg_frame_rate = framerate; avpriv_set_pts_info(st, 64, 1, 1200000); fail: diff --git a/tests/ref/fate/h264-lossless b/tests/ref/fate/h264-lossless index c6659ca830..30a70b5118 100644 --- a/tests/ref/fate/h264-lossless +++ b/tests/ref/fate/h264-lossless @@ -1,10 +1,10 @@ 0, 0, 460800, 0x7731dd2f -0, 1500, 460800, 0x944b8c64 -0, 3000, 460800, 0xbe833041 -0, 4500, 460800, 0xbe95d96a -0, 6000, 460800, 0xfe7ea5e6 -0, 7500, 460800, 0x381743c7 -0, 9000, 460800, 0x63fcc2e9 -0, 10500, 460800, 0x79574960 -0, 12000, 460800, 0xdab9e18a -0, 13500, 460800, 0xd88e8fe8 +0, 3600, 460800, 0x944b8c64 +0, 7200, 460800, 0xbe833041 +0, 10800, 460800, 0xbe95d96a +0, 14400, 460800, 0xfe7ea5e6 +0, 18000, 460800, 0x381743c7 +0, 21600, 460800, 0x63fcc2e9 +0, 25200, 460800, 0x79574960 +0, 28800, 460800, 0xdab9e18a +0, 32400, 460800, 0xd88e8fe8 -- cgit v1.2.3