mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Changed the way frame types are propagated to the video packetizer: now the bref is evaluated. If it is set to != -1 then it is a P frame, otherwise it is an I frame.
This commit is contained in:
parent
f7bac6ea4d
commit
72eb77ee54
15
p_video.cpp
15
p_video.cpp
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_video.cpp,v 1.25 2003/04/20 14:59:33 mosu Exp $
|
||||
\version \$Id: p_video.cpp,v 1.26 2003/04/20 19:32:11 mosu Exp $
|
||||
\brief video output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -37,7 +37,6 @@ video_packetizer_c::video_packetizer_c(double nfps, int nwidth,
|
||||
int nheight, int nbpp,
|
||||
int navi_compat_mode, track_info_t *nti)
|
||||
throw (error_c) : generic_packetizer_c(nti) {
|
||||
packetno = 0;
|
||||
fps = nfps;
|
||||
width = nwidth;
|
||||
height = nheight;
|
||||
@ -73,18 +72,16 @@ void video_packetizer_c::set_header() {
|
||||
}
|
||||
|
||||
int video_packetizer_c::process(unsigned char *buf, int size,
|
||||
int64_t old_timecode, int64_t flags, int64_t,
|
||||
int64_t old_timecode, int64_t, int64_t bref,
|
||||
int64_t) {
|
||||
int64_t timecode;
|
||||
int num_frames;
|
||||
|
||||
num_frames = flags & VNUMFRAMES;
|
||||
if (old_timecode == -1)
|
||||
timecode = (int64_t)(1000.0 * frames_output / fps);
|
||||
else
|
||||
timecode = old_timecode;
|
||||
|
||||
if ((flags & VFT_IFRAME) != 0) {
|
||||
if (bref == -1) {
|
||||
// Add a key frame and save its timecode so that we can reference it later.
|
||||
add_packet(buf, size, timecode);
|
||||
ref_timecode = timecode;
|
||||
@ -94,11 +91,7 @@ int video_packetizer_c::process(unsigned char *buf, int size,
|
||||
ref_timecode = timecode;
|
||||
}
|
||||
|
||||
if (num_frames > 1)
|
||||
fprintf(stdout, "Warning: video_packetizer: num_frames > 1\n");
|
||||
frames_output += num_frames;
|
||||
|
||||
packetno++;
|
||||
frames_output++;
|
||||
|
||||
return EMOREDATA;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_video.h,v 1.20 2003/04/18 13:21:11 mosu Exp $
|
||||
\version \$Id: p_video.h,v 1.21 2003/04/20 19:32:11 mosu Exp $
|
||||
\brief class definition for the video output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
class video_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
double fps;
|
||||
int width, height, bpp, packetno;
|
||||
int width, height, bpp;
|
||||
int frames_output, avi_compat_mode;
|
||||
int64_t ref_timecode;
|
||||
|
||||
|
13
r_avi.cpp
13
r_avi.cpp
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: r_avi.cpp,v 1.20 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: r_avi.cpp,v 1.21 2003/04/20 19:32:11 mosu Exp $
|
||||
\brief AVI demultiplexer module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -353,8 +353,8 @@ int avi_reader_c::read() {
|
||||
while (!done && (frames <= (maxframes - 1))) {
|
||||
nread = AVI_read_frame(avi, (char *)chunk, &key);
|
||||
if (nread < 0) {
|
||||
vpacketizer->process(old_chunk, old_nread, -1,
|
||||
frames_read | (old_key ? VFT_IFRAME : 0));
|
||||
vpacketizer->process(old_chunk, old_nread, -1, -1,
|
||||
old_key ? -1 : 0);
|
||||
frames = maxframes + 1;
|
||||
break;
|
||||
}
|
||||
@ -370,8 +370,8 @@ int avi_reader_c::read() {
|
||||
frames++;
|
||||
}
|
||||
if (nread > 0) {
|
||||
vpacketizer->process(old_chunk, old_nread, -1,
|
||||
frames_read | (old_key ? VFT_IFRAME : 0));
|
||||
vpacketizer->process(old_chunk, old_nread, -1, -1,
|
||||
old_key ? -1 : 0);
|
||||
if (! last_frame) {
|
||||
if (old_chunk != NULL)
|
||||
free(old_chunk);
|
||||
@ -384,7 +384,8 @@ int avi_reader_c::read() {
|
||||
old_key = key;
|
||||
old_nread = nread;
|
||||
} else if (nread > 0)
|
||||
vpacketizer->process(chunk, nread, -1, 1 | (key ? VFT_IFRAME : 0));
|
||||
vpacketizer->process(chunk, nread, -1, -1,
|
||||
key ? -1 : 0);
|
||||
}
|
||||
}
|
||||
if (last_frame) {
|
||||
|
10
r_ogm.cpp
10
r_ogm.cpp
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: r_ogm.cpp,v 1.16 2003/04/20 17:22:04 mosu Exp $
|
||||
\version \$Id: r_ogm.cpp,v 1.17 2003/04/20 19:32:11 mosu Exp $
|
||||
\brief OGG media stream reader
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -584,11 +584,13 @@ void ogm_reader_c::process_page(ogg_page *og) {
|
||||
((*op.packet & 3) != PACKET_TYPE_COMMENT)) {
|
||||
|
||||
if (dmx->stype == OGM_STREAM_TYPE_VIDEO) {
|
||||
flags = hdrlen > 0 ? lenbytes : 1;
|
||||
// flags = hdrlen > 0 ? lenbytes : 1;
|
||||
if (*op.packet & PACKET_IS_SYNCPOINT)
|
||||
flags |= VFT_IFRAME;
|
||||
flags = VFT_IFRAME;
|
||||
else
|
||||
flags = -1;
|
||||
dmx->packetizer->process(&op.packet[hdrlen + 1], op.bytes - 1 - hdrlen,
|
||||
-1, flags);
|
||||
-1, -1, flags);
|
||||
dmx->units_processed += (hdrlen > 0 ? lenbytes : 1);
|
||||
|
||||
} else if (dmx->stype == OGM_STREAM_TYPE_TEXT) {
|
||||
|
Loading…
Reference in New Issue
Block a user