diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-17 14:23:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-08-17 14:23:20 +0200 |
commit | 27fbe31c921f49078764a69ccb701dbb767c7410 (patch) | |
tree | 5a80541540a0a72063c3fa854febb77afc6518b7 | |
parent | d071df888d5896031380b2b1733bd0cec833c3b6 (diff) | |
parent | 6cd9d0f77d527491d0c3626f16b8e125a8a9344b (diff) | |
download | ffmpeg-27fbe31c921f49078764a69ccb701dbb767c7410.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
Revert "avconv: use stream copy by default when possible."
avconv: print stream copy information.
avconv: use stream copy by default when possible.
matroskaenc: vertical alignment.
matroskaenc: implement query_codec()
lavf: add avformat_query_codec().
lavc: add avcodec_get_type() for mapping codec_id -> type.
flvenc: use int64_t to store offsets
avconv: don't segfault on 0 input files.
Do not write ID3v1 tags by default
mpegts: log into an AVFormatContext rather than MpegTSContext.
Conflicts:
doc/APIchanges
libavcodec/version.h
libavformat/avformat.h
libavformat/mp3enc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | avconv.c | 4 | ||||
-rw-r--r-- | doc/APIchanges | 6 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 8 | ||||
-rw-r--r-- | libavcodec/utils.c | 14 | ||||
-rw-r--r-- | libavcodec/version.h | 2 | ||||
-rw-r--r-- | libavformat/avformat.h | 18 | ||||
-rw-r--r-- | libavformat/flvenc.c | 2 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 23 | ||||
-rw-r--r-- | libavformat/mp3enc.c | 5 | ||||
-rw-r--r-- | libavformat/utils.c | 14 |
10 files changed, 89 insertions, 7 deletions
@@ -2280,6 +2280,8 @@ static int transcode(AVFormatContext **output_files, fprintf(stderr, " [sync #%d.%d]", ost->sync_ist->file_index, ost->sync_ist->st->index); + if (ost->st->stream_copy) + fprintf(stderr, " (copy)"); fprintf(stderr, "\n"); } } @@ -3804,7 +3806,7 @@ static int opt_output_file(const char *opt, const char *filename) } /* copy global metadata by default */ - if (metadata_global_autocopy) + if (metadata_global_autocopy && nb_input_files) av_dict_copy(&oc->metadata, input_files[0].ctx->metadata, AV_DICT_DONT_OVERWRITE); if (metadata_streams_autocopy) diff --git a/doc/APIchanges b/doc/APIchanges index ca7a6b8b4d..ed87c0d252 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -16,6 +16,12 @@ API changes, most recent first: 2011-08-14 - xxxxxx - lavu 52.12.0 Add av_fifo_peek2(), deprecate av_fifo_peek(). +2011-08-xx - xxxxxxx - lavf 53.4.0 + Add avformat_query_codec(). + +2011-08-xx - xxxxxxx - lavc 53.8.0 + Add avcodec_get_type(). + 2011-08-06 - 2f63440 - lavf 53.4.0 Add error_recognition to AVFormatContext. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4f0ed2d385..7c82d737bd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -212,6 +212,7 @@ enum CodecID { CODEC_ID_G2M, /* various PCM "codecs" */ + CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs CODEC_ID_PCM_S16LE= 0x10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, @@ -343,6 +344,7 @@ enum CodecID { CODEC_ID_CELT, /* subtitle codecs */ + CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. CODEC_ID_DVD_SUBTITLE= 0x17000, CODEC_ID_DVB_SUBTITLE, CODEC_ID_TEXT, ///< raw UTF-8 text @@ -355,6 +357,7 @@ enum CodecID { CODEC_ID_MICRODVD, /* other specific kind of codecs (generally used for attachments) */ + CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. CODEC_ID_TTF= 0x18000, CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it @@ -4342,4 +4345,9 @@ enum AVLockOp { */ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum CodecID codec_id); + #endif /* AVCODEC_AVCODEC_H */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 6175d8302f..ce8c0993a9 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1380,3 +1380,17 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count) return ff_thread_init(s); } #endif + +enum AVMediaType avcodec_get_type(enum CodecID codec_id) +{ + if (codec_id <= CODEC_ID_NONE) + return AVMEDIA_TYPE_UNKNOWN; + else if (codec_id < CODEC_ID_FIRST_AUDIO) + return AVMEDIA_TYPE_VIDEO; + else if (codec_id < CODEC_ID_FIRST_SUBTITLE) + return AVMEDIA_TYPE_AUDIO; + else if (codec_id < CODEC_ID_FIRST_UNKNOWN) + return AVMEDIA_TYPE_SUBTITLE; + + return AVMEDIA_TYPE_UNKNOWN; +} diff --git a/libavcodec/version.h b/libavcodec/version.h index adb9c95d94..f06184bded 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,7 +21,7 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 10 +#define LIBAVCODEC_VERSION_MINOR 11 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavformat/avformat.h b/libavformat/avformat.h index aef80e3291..5e73f8dc06 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -324,6 +324,14 @@ typedef struct AVOutputFormat { const AVClass *priv_class; ///< AVClass for the private context + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + */ + int (*query_codec)(enum CodecID id, int std_compliance); + void (*get_output_timestamp)(struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall); @@ -1690,4 +1698,14 @@ attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char */ int av_match_ext(const char *filename, const char *extensions); +/** + * Test if the given container can store a codec. + * + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance); + #endif /* AVFORMAT_AVFORMAT_H */ diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index d8d915e269..363309c75a 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -180,7 +180,7 @@ static int flv_write_header(AVFormatContext *s) AVCodecContext *audio_enc = NULL, *video_enc = NULL; int i; double framerate = 0.0; - int metadata_size_pos, data_size; + int64_t metadata_size_pos, data_size; AVDictionaryEntry *tag = NULL; for(i=0; i<s->nb_streams; i++){ diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index ecc5e6bbb3..8cf781ddcd 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1198,6 +1198,22 @@ static int mkv_write_trailer(AVFormatContext *s) return 0; } +static int mkv_query_codec(enum CodecID codec_id, int std_compliance) +{ + int i; + for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++) + if (ff_mkv_codec_tags[i].id == codec_id) + return 1; + + if (std_compliance < FF_COMPLIANCE_NORMAL) { // mkv theoretically supports any + enum AVMediaType type = avcodec_get_type(codec_id); // video/audio through VFW/ACM + if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) + return 1; + } + + return 0; +} + #if CONFIG_MATROSKA_MUXER AVOutputFormat ff_matroska_muxer = { .name = "matroska", @@ -1210,9 +1226,10 @@ AVOutputFormat ff_matroska_muxer = { .write_header = mkv_write_header, .write_packet = mkv_write_packet, .write_trailer = mkv_write_trailer, - .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, - .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0}, - .subtitle_codec = CODEC_ID_SSA, + .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, + .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0}, + .subtitle_codec = CODEC_ID_SSA, + .query_codec = mkv_query_codec, }; #endif diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 9caa65282b..7e96d47995 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -141,6 +141,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 typedef struct MP3Context { const AVClass *class; int id3v2_version; + int write_id3v1; int64_t frames_offset; int32_t frames; int32_t size; @@ -156,7 +157,7 @@ static int mp2_write_trailer(struct AVFormatContext *s) MP3Context *mp3 = s->priv_data; /* write the id3v1 tag */ - if (id3v1_create_tag(s, buf) > 0) { + if (mp3 && mp3->write_id3v1 && id3v1_create_tag(s, buf) > 0) { avio_write(s->pb, buf, ID3v1_TAG_SIZE); } @@ -190,6 +191,8 @@ AVOutputFormat ff_mp2_muxer = { static const AVOption options[] = { { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.", offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM}, + { "write_id3v1", "Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software.", + offsetof(MP3Context, write_id3v1), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { NULL }, }; diff --git a/libavformat/utils.c b/libavformat/utils.c index aa1220dbbc..022efc4d56 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4035,3 +4035,17 @@ int64_t ff_iso8601_to_unix_time(const char *datestr) return 0; #endif } + +int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance) +{ + if (ofmt) { + if (ofmt->query_codec) + return ofmt->query_codec(codec_id, std_compliance); + else if (ofmt->codec_tag) + return !!av_codec_get_tag(ofmt->codec_tag, codec_id); + else if (codec_id == ofmt->video_codec || codec_id == ofmt->audio_codec || + codec_id == ofmt->subtitle_codec) + return 1; + } + return AVERROR_PATCHWELCOME; +} |