[FFmpeg-devel] [PATCH] mxfenc: audio only support
Michael Niedermayer
michaelni at gmx.at
Sun Apr 1 21:36:43 CEST 2012
Fixes Ticket810
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavformat/mxfenc.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 810c566..9a9e244 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1401,6 +1401,7 @@ static int mxf_write_header(AVFormatContext *s)
const int *samples_per_frame = NULL;
AVDictionaryEntry *t;
int64_t timestamp = 0;
+ AVRational rate;
if (!s->nb_streams)
return -1;
@@ -1413,7 +1414,6 @@ static int mxf_write_header(AVFormatContext *s)
st->priv_data = sc;
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- AVRational rate;
if (i != 0) {
av_log(s, AV_LOG_ERROR, "video stream must be first track\n");
return -1;
@@ -1432,13 +1432,6 @@ static int mxf_write_header(AVFormatContext *s)
}
rate = (AVRational){mxf->time_base.den, mxf->time_base.num};
avpriv_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
- if (mxf->tc_opt_str)
- ret = av_timecode_init_from_string(&mxf->tc, rate,
- mxf->tc_opt_str, s);
- else
- ret = av_timecode_init(&mxf->tc, rate, 0, 0, s);
- if (ret < 0)
- return ret;
if (s->oformat == &ff_mxf_d10_muxer) {
if (st->codec->bit_rate == 50000000)
if (mxf->time_base.den == 25) sc->index = 3;
@@ -1467,6 +1460,10 @@ static int mxf_write_header(AVFormatContext *s)
return -1;
}
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ if (!mxf->time_base.num) {
+ mxf->time_base = (AVRational){ 1, st->codec->sample_rate };
+ rate = (AVRational){ 30, 1 };
+ }
if (s->oformat == &ff_mxf_d10_muxer) {
if (st->index != 1) {
av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
@@ -1480,6 +1477,13 @@ static int mxf_write_header(AVFormatContext *s)
} else
mxf->slice_count = 1;
}
+ if (mxf->tc_opt_str)
+ ret = av_timecode_init_from_string(&mxf->tc, rate,
+ mxf->tc_opt_str, s);
+ else
+ ret = av_timecode_init(&mxf->tc, rate, 0, 0, s);
+ if (ret < 0)
+ return ret;
if (!sc->index) {
sc->index = mxf_get_essence_container_ul_index(st->codec->codec_id);
--
1.7.5.4
More information about the ffmpeg-devel
mailing list