[FFmpeg-cvslog] avconv: add support for copying attachments.
Anton Khirnov
git at videolan.org
Wed Sep 28 02:11:05 CEST 2011
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Sep 27 10:37:22 2011 +0200| [3ccd15803bc1dd06cf2646ade92891dada5417ea] | committer: Anton Khirnov
avconv: add support for copying attachments.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ccd15803bc1dd06cf2646ade92891dada5417ea
---
avconv.c | 9 +++++++++
cmdutils.c | 3 ++-
doc/avtools-common-opts.texi | 7 ++++---
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/avconv.c b/avconv.c
index 4d789e0..9d2ad51 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1991,6 +1991,7 @@ static int transcode_init(OutputFile *output_files,
codec->height = icodec->height;
break;
case AVMEDIA_TYPE_DATA:
+ case AVMEDIA_TYPE_ATTACHMENT:
break;
default:
abort();
@@ -3160,6 +3161,13 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc)
return ost;
}
+static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc)
+{
+ OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT);
+ ost->st->stream_copy = 1;
+ return ost;
+}
+
static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc)
{
AVStream *st;
@@ -3375,6 +3383,7 @@ static void opt_output_file(void *optctx, const char *filename)
case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break;
case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break;
case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break;
+ case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break;
default:
av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d.%d - unsupported type.\n",
map->file_index, map->stream_index);
diff --git a/cmdutils.c b/cmdutils.c
index 1e873e6..2c37880 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -858,7 +858,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
{
if (*spec <= '9' && *spec >= '0') /* opt:index */
return strtol(spec, NULL, 0) == st->index;
- else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd') { /* opt:[vasd] */
+ else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' || *spec == 't') { /* opt:[vasdt] */
enum AVMediaType type;
switch (*spec++) {
@@ -866,6 +866,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
case 'a': type = AVMEDIA_TYPE_AUDIO; break;
case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break;
+ case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
}
if (type != st->codec->codec_type)
return 0;
diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi
index 0f0ecdf..634b152 100644
--- a/doc/avtools-common-opts.texi
+++ b/doc/avtools-common-opts.texi
@@ -33,9 +33,10 @@ Possible forms of stream specifiers are:
Matches the stream with this index. E.g. @code{-threads:1 4} would set the
thread count for the second stream to 4.
@item @var{stream_type}[:@var{stream_index}]
- at var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle and
-'d' for data. If @var{stream_index} is given, then matches stream number
- at var{stream_index} of this type. Otherwise matches all streams of this type.
+ at var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle,
+'d' for data and 't' for attachments. If @var{stream_index} is given, then
+matches stream number @var{stream_index} of this type. Otherwise matches all
+streams of this type.
@item @var{program_id}[:@var{stream_index}]
If @var{stream_index} is given, then matches stream number @var{stream_index} in
program with id @var{program_id}. Otherwise matches all streams in this program.
More information about the ffmpeg-cvslog
mailing list