summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-09-27 10:37:22 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-27 15:26:36 +0200
commit3ccd15803bc1dd06cf2646ade92891dada5417ea (patch)
tree494a2b49b64cb3eff661b7aeaba17b40bac88ef6
parentc7a63a521b5c165405e3577751d649529d09f0c5 (diff)
avconv: add support for copying attachments.
-rw-r--r--avconv.c9
-rw-r--r--cmdutils.c3
-rw-r--r--doc/avtools-common-opts.texi7
3 files changed, 15 insertions, 4 deletions
diff --git a/avconv.c b/avconv.c
index 4d789e0ca2..9d2ad51740 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 1e873e66a1..2c37880d74 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 0f0ecdf943..634b152ccc 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}]
-@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
-@var{stream_index} of this type. Otherwise matches all streams of this type.
+@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.