From 8b5d160c70d3c1ddbc7b505e68ee422a6f381a22 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 24 Jun 2005 07:52:23 +0000 Subject: [PATCH] The MPEG-1/-2 video packetizer has to create a new packet_t structure for each packet it passes downstream because it may produce more than one output packet from each input packet, and packet_t structures must only be used once. --- src/output/p_video.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index 9632d2e79..b1ebc5a2d 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -219,15 +219,13 @@ mpeg1_2_video_packetizer_c::process(packet_cptr packet) { if (hcodec_private == NULL) create_private_data(); - packet->memory = memory_cptr(new memory_c(frame->data, frame->size, - true)); - packet->timecode = frame->timecode; - packet->duration = frame->duration; - packet->bref = frame->firstRef; - packet->fref = frame->secondRef; - packet->time_factor = + packet_t *new_packet = + new packet_t(new memory_c(frame->data, frame->size, true), + frame->timecode, frame->duration, + frame->firstRef, frame->secondRef); + new_packet->time_factor = MPEG2_PICTURE_TYPE_FRAME == frame->pictureStructure ? 1 : 2; - video_packetizer_c::process(packet); + video_packetizer_c::process(packet_cptr(new_packet)); frame->data = NULL; delete frame;