diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2013-04-29 20:46:00 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2013-05-01 11:56:34 +0200 |
commit | 276fcbde6c5532a02aacd2e2d31beaa8d4e79a8a (patch) | |
tree | 4be6e1184e3add477dd4daae5de6ede40e2ec8cc /libavformat | |
parent | 3319679d0a36bec3e78f639d6f9fbbe596f6eec3 (diff) | |
download | ffmpeg-276fcbde6c5532a02aacd2e2d31beaa8d4e79a8a.tar.gz |
lavf: data muxer and demuxer.
Allow to use tools designed to work with demuxers, muxers
and packets (for example ffmpeg itself) to process raw byte
streams (like aviocat).
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 2 | ||||
-rw-r--r-- | libavformat/allformats.c | 1 | ||||
-rw-r--r-- | libavformat/rawdec.c | 21 | ||||
-rw-r--r-- | libavformat/rawenc.c | 9 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
5 files changed, 34 insertions, 1 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index ca74102875..36797085a0 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -103,6 +103,8 @@ OBJS-$(CONFIG_CDG_DEMUXER) += cdg.o OBJS-$(CONFIG_CDXL_DEMUXER) += cdxl.o OBJS-$(CONFIG_CONCAT_DEMUXER) += concatdec.o OBJS-$(CONFIG_CRC_MUXER) += crcenc.o +OBJS-$(CONFIG_DATA_DEMUXER) += rawdec.o +OBJS-$(CONFIG_DATA_MUXER) += rawdec.o OBJS-$(CONFIG_DAUD_DEMUXER) += daud.o OBJS-$(CONFIG_DAUD_MUXER) += daud.o OBJS-$(CONFIG_DFA_DEMUXER) += dfa.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index f29843a52e..bca2c401a5 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -100,6 +100,7 @@ void av_register_all(void) REGISTER_DEMUXER (CDXL, cdxl); REGISTER_DEMUXER (CONCAT, concat); REGISTER_MUXER (CRC, crc); + REGISTER_MUXDEMUX(DATA, data); REGISTER_MUXDEMUX(DAUD, daud); REGISTER_DEMUXER (DFA, dfa); REGISTER_MUXDEMUX(DIRAC, dirac); diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 153cc7b04e..a9ff22ae18 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -90,6 +90,17 @@ fail: return ret; } +static int ff_raw_data_read_header(AVFormatContext *s) +{ + AVStream *st = avformat_new_stream(s, NULL); + if (!st) + return AVERROR(ENOMEM); + st->codec->codec_type = AVMEDIA_TYPE_DATA; + st->codec->codec_id = s->iformat->raw_codec_id; + st->start_time = 0; + return 0; +} + /* Note: Do not forget to add new entries to the Makefile as well. */ #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) @@ -99,6 +110,16 @@ const AVOption ff_rawvideo_options[] = { { NULL }, }; +#if CONFIG_DATA_DEMUXER +AVInputFormat ff_data_demuxer = { + .name = "data", + .long_name = NULL_IF_CONFIG_SMALL("raw data"), + .read_header = ff_raw_data_read_header, + .read_packet = ff_raw_read_partial_packet, + .raw_codec_id = AV_CODEC_ID_NONE, +}; +#endif + #if CONFIG_LATM_DEMUXER AVInputFormat ff_latm_demuxer = { .name = "latm", diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 7894c8e0c5..7a1fa93e8b 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -68,6 +68,15 @@ AVOutputFormat ff_cavsvideo_muxer = { }; #endif +#if CONFIG_DATA_MUXER +AVOutputFormat ff_data_muxer = { + .name = "data", + .long_name = NULL_IF_CONFIG_SMALL("raw data"), + .write_packet = ff_raw_write_packet, + .flags = AVFMT_NOTIMESTAMPS, +}; +#endif + #if CONFIG_DIRAC_MUXER AVOutputFormat ff_dirac_muxer = { .name = "dirac", diff --git a/libavformat/version.h b/libavformat/version.h index 8fd08cf032..3e186a9e02 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,7 +30,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 55 -#define LIBAVFORMAT_VERSION_MINOR 3 +#define LIBAVFORMAT_VERSION_MINOR 4 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |