Commit d643bd49 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/yop: Use av_packet_move_ref() for packet ownership transfer

Also return 0 after successfully reading a packet.
Reviewed-by: 's avatarAnton Khirnov <anton@khirnov.net>
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent 9a966770
......@@ -125,14 +125,11 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
yop->video_packet.stream_index = 1;
if (yop->video_packet.data) {
*pkt = yop->video_packet;
yop->video_packet.data = NULL;
yop->video_packet.buf = NULL;
yop->video_packet.size = 0;
av_packet_move_ref(pkt, &yop->video_packet);
pkt->data[0] = yop->odd_frame;
pkt->flags |= AV_PKT_FLAG_KEY;
yop->odd_frame ^= 1;
return pkt->size;
return 0;
}
ret = av_new_packet(&yop->video_packet,
yop->frame_size - yop->audio_block_length);
......@@ -166,7 +163,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
av_shrink_packet(&yop->video_packet, yop->palette_size + ret);
// Arbitrarily return the audio data first
return yop->audio_block_length;
return 0;
err_out:
av_packet_unref(&yop->video_packet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment