提交 bb62d5c1 编写于 作者: A Anton Khirnov

Allow output formats without any streams.

Required for future metadata format.

Originally committed as revision 26100 to svn://svn.ffmpeg.org/ffmpeg/trunk
上级 18f1add3
...@@ -1990,7 +1990,7 @@ static int transcode(AVFormatContext **output_files, ...@@ -1990,7 +1990,7 @@ static int transcode(AVFormatContext **output_files,
nb_ostreams = 0; nb_ostreams = 0;
for(i=0;i<nb_output_files;i++) { for(i=0;i<nb_output_files;i++) {
os = output_files[i]; os = output_files[i];
if (!os->nb_streams) { if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) {
dump_format(output_files[i], i, output_files[i]->filename, 1); dump_format(output_files[i], i, output_files[i]->filename, 1);
fprintf(stderr, "Output file #%d does not contain any stream\n", i); fprintf(stderr, "Output file #%d does not contain any stream\n", i);
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
......
...@@ -323,6 +323,7 @@ typedef struct AVFormatParameters { ...@@ -323,6 +323,7 @@ typedef struct AVFormatParameters {
#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ #define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */
#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ #define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */
#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ #define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */
#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */
typedef struct AVOutputFormat { typedef struct AVOutputFormat {
const char *name; const char *name;
......
...@@ -2709,7 +2709,7 @@ int av_write_header(AVFormatContext *s) ...@@ -2709,7 +2709,7 @@ int av_write_header(AVFormatContext *s)
AVStream *st; AVStream *st;
// some sanity checks // some sanity checks
if (s->nb_streams == 0) { if (s->nb_streams == 0 && !(s->oformat->flags & AVFMT_NOSTREAMS)) {
av_log(s, AV_LOG_ERROR, "no streams\n"); av_log(s, AV_LOG_ERROR, "no streams\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
...@@ -2777,7 +2777,7 @@ int av_write_header(AVFormatContext *s) ...@@ -2777,7 +2777,7 @@ int av_write_header(AVFormatContext *s)
#endif #endif
/* set muxer identification string */ /* set muxer identification string */
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册