mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Added suggested timecode to process.
This commit is contained in:
parent
4a1b86b563
commit
c2811893b3
18
p_video.cpp
18
p_video.cpp
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file
|
\file
|
||||||
\version \$Id: p_video.cpp,v 1.8 2003/02/28 18:54:14 mosu Exp $
|
\version \$Id: p_video.cpp,v 1.9 2003/03/01 16:59:59 mosu Exp $
|
||||||
\brief video output module
|
\brief video output module
|
||||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||||
*/
|
*/
|
||||||
@ -115,23 +115,29 @@ void video_packetizer_c::set_header() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int video_packetizer_c::process(char *buf, int size, int num_frames,
|
int video_packetizer_c::process(char *buf, int size, int num_frames,
|
||||||
int key, int last_frame) {
|
int key, int last_frame,
|
||||||
|
u_int64_t old_timecode) {
|
||||||
|
u_int64_t timecode;
|
||||||
|
|
||||||
if (size > max_frame_size) {
|
if (size > max_frame_size) {
|
||||||
fprintf(stderr, "FATAL: p_video: size (%d) > max_frame_size (%d)\n",
|
fprintf(stderr, "FATAL: p_video: size (%d) > max_frame_size (%d)\n",
|
||||||
size, max_frame_size);
|
size, max_frame_size);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (old_timecode == 0)
|
||||||
|
timecode = (u_int64_t)(1000.0 * frames_output / fps);
|
||||||
|
else
|
||||||
|
timecode = old_timecode;
|
||||||
|
|
||||||
if ((packetno >= range.start) &&
|
if ((packetno >= range.start) &&
|
||||||
((range.end == 0) || (packetno < range.end))) {
|
((range.end == 0) || (packetno < range.end))) {
|
||||||
if (key)
|
if (key)
|
||||||
// Add a key frame and save its ID so that we can reference it later.
|
// Add a key frame and save its ID so that we can reference it later.
|
||||||
last_id = add_packet(buf, size,
|
last_id = add_packet(buf, size, timecode);
|
||||||
(u_int64_t)(1000.0 * frames_output / fps));
|
|
||||||
else
|
else
|
||||||
// This is a P frame - let's reference the last frame.
|
// This is a P frame - let's reference the last frame.
|
||||||
last_id = add_packet(buf, size,
|
last_id = add_packet(buf, size, timecode, last_id);
|
||||||
(u_int64_t)(1000.0 * frames_output / fps), last_id);
|
|
||||||
frames_output += num_frames;
|
frames_output += num_frames;
|
||||||
}
|
}
|
||||||
packetno++;
|
packetno++;
|
||||||
|
Loading…
Reference in New Issue
Block a user