avconv: add support for copying attachments.

pull/2/head
Anton Khirnov 13 years ago
parent c7a63a521b
commit 3ccd15803b
  1. 9
      avconv.c
  2. 3
      cmdutils.c
  3. 7
      doc/avtools-common-opts.texi

@ -1991,6 +1991,7 @@ static int transcode_init(OutputFile *output_files,
codec->height = icodec->height; codec->height = icodec->height;
break; break;
case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_DATA:
case AVMEDIA_TYPE_ATTACHMENT:
break; break;
default: default:
abort(); abort();
@ -3160,6 +3161,13 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc)
return ost; 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) static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc)
{ {
AVStream *st; 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_AUDIO: ost = new_audio_stream(o, oc); break;
case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_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_DATA: ost = new_data_stream(o, oc); break;
case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break;
default: default:
av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d.%d - unsupported type.\n", av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d.%d - unsupported type.\n",
map->file_index, map->stream_index); map->file_index, map->stream_index);

@ -858,7 +858,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
{ {
if (*spec <= '9' && *spec >= '0') /* opt:index */ if (*spec <= '9' && *spec >= '0') /* opt:index */
return strtol(spec, NULL, 0) == st->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; enum AVMediaType type;
switch (*spec++) { 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 'a': type = AVMEDIA_TYPE_AUDIO; break;
case 's': type = AVMEDIA_TYPE_SUBTITLE; break; case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break; case 'd': type = AVMEDIA_TYPE_DATA; break;
case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
} }
if (type != st->codec->codec_type) if (type != st->codec->codec_type)
return 0; return 0;

@ -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 Matches the stream with this index. E.g. @code{-threads:1 4} would set the
thread count for the second stream to 4. thread count for the second stream to 4.
@item @var{stream_type}[:@var{stream_index}] @item @var{stream_type}[:@var{stream_index}]
@var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle and @var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle,
'd' for data. If @var{stream_index} is given, then matches stream number 'd' for data and 't' for attachments. If @var{stream_index} is given, then
@var{stream_index} of this type. Otherwise matches all streams of this type. matches stream number @var{stream_index} of this type. Otherwise matches all
streams of this type.
@item @var{program_id}[:@var{stream_index}] @item @var{program_id}[:@var{stream_index}]
If @var{stream_index} is given, then matches stream number @var{stream_index} in 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. program with id @var{program_id}. Otherwise matches all streams in this program.

Loading…
Cancel
Save