Message ID | 20171127171708.5640-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 9924f1bc34242bb9315c355108f3ce744c1f33c5 |
Headers | show |
2017-11-27 18:17 GMT+01:00 James Almer <jamrial@gmail.com>: > It's the correct place for them. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavformat/matroskaenc.c | 39 +++++++++++++++++++++------------------ > 1 file changed, 21 insertions(+), 18 deletions(-) > > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c > index 06126781f8..35857bb02e 100644 > --- a/libavformat/matroskaenc.c > +++ b/libavformat/matroskaenc.c > @@ -1859,25 +1859,7 @@ static int mkv_write_header(AVFormatContext *s) > av_dict_get(s->metadata, "alpha_mode", NULL, 0)) > version = 4; > > - if (s->nb_streams > MAX_TRACKS) { > - av_log(s, AV_LOG_ERROR, > - "At most %d streams are supported for muxing in Matroska\n", > - MAX_TRACKS); > - return AVERROR(EINVAL); > - } > - > for (i = 0; i < s->nb_streams; i++) { > - if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || > - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || > - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || > - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || > - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || > - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { > - av_log(s, AV_LOG_ERROR, > - "The Matroska muxer does not yet support muxing %s\n", > - avcodec_get_name(s->streams[i]->codecpar->codec_id)); > - return AVERROR_PATCHWELCOME; > - } > if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_OPUS || > av_dict_get(s->streams[i]->metadata, "stereo_mode", NULL, 0) || > av_dict_get(s->streams[i]->metadata, "alpha_mode", NULL, 0)) > @@ -2656,6 +2638,27 @@ static int mkv_init(struct AVFormatContext *s) > { > int i; > > + if (s->nb_streams > MAX_TRACKS) { > + av_log(s, AV_LOG_ERROR, > + "At most %d streams are supported for muxing in Matroska\n", > + MAX_TRACKS); > + return AVERROR(EINVAL); > + } > + > + for (i = 0; i < s->nb_streams; i++) { > + if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || > + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || > + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || > + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || > + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || > + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { > + av_log(s, AV_LOG_ERROR, > + "The Matroska muxer does not yet support muxing %s\n", > + avcodec_get_name(s->streams[i]->codecpar->codec_id)); > + return AVERROR_PATCHWELCOME; > + } > + } (Since I may have written this) If this is the more correct place, please commit. Carl Eugen
On 11/27/2017 7:44 PM, Carl Eugen Hoyos wrote: > 2017-11-27 18:17 GMT+01:00 James Almer <jamrial@gmail.com>: >> It's the correct place for them. >> >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavformat/matroskaenc.c | 39 +++++++++++++++++++++------------------ >> 1 file changed, 21 insertions(+), 18 deletions(-) >> >> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c >> index 06126781f8..35857bb02e 100644 >> --- a/libavformat/matroskaenc.c >> +++ b/libavformat/matroskaenc.c >> @@ -1859,25 +1859,7 @@ static int mkv_write_header(AVFormatContext *s) >> av_dict_get(s->metadata, "alpha_mode", NULL, 0)) >> version = 4; >> >> - if (s->nb_streams > MAX_TRACKS) { >> - av_log(s, AV_LOG_ERROR, >> - "At most %d streams are supported for muxing in Matroska\n", >> - MAX_TRACKS); >> - return AVERROR(EINVAL); >> - } >> - >> for (i = 0; i < s->nb_streams; i++) { >> - if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || >> - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || >> - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || >> - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || >> - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || >> - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { >> - av_log(s, AV_LOG_ERROR, >> - "The Matroska muxer does not yet support muxing %s\n", >> - avcodec_get_name(s->streams[i]->codecpar->codec_id)); >> - return AVERROR_PATCHWELCOME; >> - } >> if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_OPUS || >> av_dict_get(s->streams[i]->metadata, "stereo_mode", NULL, 0) || >> av_dict_get(s->streams[i]->metadata, "alpha_mode", NULL, 0)) >> @@ -2656,6 +2638,27 @@ static int mkv_init(struct AVFormatContext *s) >> { >> int i; >> >> + if (s->nb_streams > MAX_TRACKS) { >> + av_log(s, AV_LOG_ERROR, >> + "At most %d streams are supported for muxing in Matroska\n", >> + MAX_TRACKS); >> + return AVERROR(EINVAL); >> + } >> + >> + for (i = 0; i < s->nb_streams; i++) { >> + if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || >> + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || >> + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || >> + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || >> + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || >> + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { >> + av_log(s, AV_LOG_ERROR, >> + "The Matroska muxer does not yet support muxing %s\n", >> + avcodec_get_name(s->streams[i]->codecpar->codec_id)); >> + return AVERROR_PATCHWELCOME; >> + } >> + } > > (Since I may have written this) > > If this is the more correct place, please commit. > > Carl Eugen Applied, thanks.
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 06126781f8..35857bb02e 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1859,25 +1859,7 @@ static int mkv_write_header(AVFormatContext *s) av_dict_get(s->metadata, "alpha_mode", NULL, 0)) version = 4; - if (s->nb_streams > MAX_TRACKS) { - av_log(s, AV_LOG_ERROR, - "At most %d streams are supported for muxing in Matroska\n", - MAX_TRACKS); - return AVERROR(EINVAL); - } - for (i = 0; i < s->nb_streams; i++) { - if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || - s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { - av_log(s, AV_LOG_ERROR, - "The Matroska muxer does not yet support muxing %s\n", - avcodec_get_name(s->streams[i]->codecpar->codec_id)); - return AVERROR_PATCHWELCOME; - } if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_OPUS || av_dict_get(s->streams[i]->metadata, "stereo_mode", NULL, 0) || av_dict_get(s->streams[i]->metadata, "alpha_mode", NULL, 0)) @@ -2656,6 +2638,27 @@ static int mkv_init(struct AVFormatContext *s) { int i; + if (s->nb_streams > MAX_TRACKS) { + av_log(s, AV_LOG_ERROR, + "At most %d streams are supported for muxing in Matroska\n", + MAX_TRACKS); + return AVERROR(EINVAL); + } + + for (i = 0; i < s->nb_streams; i++) { + if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || + s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { + av_log(s, AV_LOG_ERROR, + "The Matroska muxer does not yet support muxing %s\n", + avcodec_get_name(s->streams[i]->codecpar->codec_id)); + return AVERROR_PATCHWELCOME; + } + } + if (s->avoid_negative_ts < 0) { s->avoid_negative_ts = 1; s->internal->avoid_negative_ts_use_pts = 1;
It's the correct place for them. Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/matroskaenc.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-)