[FFmpeg-devel] [PATCH] ffmpeg: Support copying unknown streams
wm4
nfxjfg at googlemail.com
Thu May 21 10:20:46 CEST 2015
On Thu, 21 May 2015 00:40:41 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> ffmpeg.c | 1 +
> ffmpeg_opt.c | 14 ++++++++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/ffmpeg.c b/ffmpeg.c
> index a89ae39..da3ab91 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -2822,6 +2822,7 @@ static int transcode_init(void)
> enc_ctx->width = dec_ctx->width;
> enc_ctx->height = dec_ctx->height;
> break;
> + case AVMEDIA_TYPE_UNKNOWN:
> case AVMEDIA_TYPE_DATA:
> case AVMEDIA_TYPE_ATTACHMENT:
> break;
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index a8d433e..4b783a5 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1565,6 +1565,19 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc, int
> return ost;
> }
>
> +static OutputStream *new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
> +{
> + OutputStream *ost;
> +
> + ost = new_output_stream(o, oc, AVMEDIA_TYPE_UNKNOWN, source_index);
> + if (!ost->stream_copy) {
> + av_log(NULL, AV_LOG_FATAL, "Unknown stream encoding not supported yet (only streamcopy)\n");
> + exit_program(1);
> + }
> +
> + return ost;
> +}
> +
> static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
> {
> OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT, source_index);
> @@ -2016,6 +2029,7 @@ loop_end:
> case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream (o, oc, src_idx); break;
> case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream (o, oc, src_idx); break;
> case AVMEDIA_TYPE_DATA: ost = new_data_stream (o, oc, src_idx); break;
> + case AVMEDIA_TYPE_UNKNOWN: ost = new_unknown_stream (o, oc, src_idx); break;
> case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break;
> default:
> av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n",
Doesn't this raise the risk of creating invalid files?
More information about the ffmpeg-devel
mailing list