Allow the user to change the FPS of all video tracks.

This commit is contained in:
Moritz Bunkus 2009-05-07 08:49:20 +02:00
parent d6e2bcff21
commit 62cca72335
6 changed files with 40 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2009-05-07 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge, mmg: enhancement: Made mmg's "FPS" input field
available for all video tracks. mkvmerge's corresponding option
"--default-duration" now not only modifies the track header field
but affects the frame timecodes as well.
2009-05-06 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: The VobSub reader was dropping the very last

View File

@ -236,6 +236,12 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *p_reader,
hserialno = create_track_number(reader, ti.id);
timecode_factory = timecode_factory_c::create(ti.ext_timecodes, ti.fname, ti.id);
// If no external timecode file but a default duration has been
// given then create a simple timecode factory that generates the
// timecodes for the given FPS.
if ((NULL == timecode_factory.get()) && (-1 != htrack_default_duration))
timecode_factory = timecode_factory_c::create_fps_factory(htrack_default_duration, ti.fname, ti.id);
}
generic_packetizer_c::~generic_packetizer_c() {

View File

@ -18,6 +18,7 @@
#include "common/common.h"
#include "common/mm_io.h"
#include "common/string_formatting.h"
#include "common/string_parsing.h"
#include "merge/pr_generic.h"
#include "merge/timecode_factory.h"
@ -63,6 +64,21 @@ timecode_factory_c::create(const string &file_name,
return timecode_factory_cptr(factory);
}
timecode_factory_cptr
timecode_factory_c::create_fps_factory(int64_t default_duration,
const string &source_name,
int64_t tid) {
mm_text_io_c text_io(new mm_mem_io_c(NULL, 0, 1024));
text_io.puts("# timecode format v1\n");
text_io.puts(boost::format("assume %1%\n") % to_string(1000000000.0 / default_duration, 9));
text_io.setFilePointer(0, seek_beginning);
timecode_factory_cptr factory(new timecode_factory_v1_c("dummy", source_name, tid));
factory->parse(text_io);
return factory;
}
void
timecode_factory_v1_c::parse(mm_io_c &in) {
string line;

View File

@ -95,6 +95,7 @@ public:
}
static timecode_factory_cptr create(const string &file_name, const string &source_name, int64_t tid);
static timecode_factory_cptr create_fps_factory(int64_t default_duration, const string &source_name, int64_t tid);
};
class timecode_factory_v1_c: public timecode_factory_c {

View File

@ -256,8 +256,8 @@ tab_input_format::set_track_mode(mmg_track_t *t) {
cob_fourcc->Enable(video);
st_stereo_mode->Enable(video);
cob_stereo_mode->Enable(video);
st_fps->Enable(avc_es);
cob_fps->Enable(avc_es);
st_fps->Enable(video);
cob_fps->Enable(video);
st_nalu_size_length->Enable(avc || avc_es);
cob_nalu_size_length->Enable(avc || avc_es);
st_compression->Enable((ctype.Find(wxT("vobsub")) >= 0) && !appending);

View File

@ -55,6 +55,14 @@ mpeg4_p10_es_video_packetizer_c(generic_reader_c *p_reader,
set_codec_private(m_avcc->get(), m_avcc->get_size());
extract_aspect_ratio();
m_parser.set_keep_ar_info(false);
// If no external timecode file has been specified then mkvmerge
// might have created a factory due to the --default-duration
// command line argument. This factory must be disabled for the AVC
// packetizer because it takes care of handling the default
// duration/FPS itself.
if (ti.ext_timecodes.empty())
timecode_factory = timecode_factory_cptr(NULL);
}
void