From b99cb8d8a526fc32dbaaf42d715bce09f19cffc8 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 17 Sep 2005 18:36:43 +0000 Subject: [PATCH] Fix H264 packetizer. Might not work with arbitrary slice order. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16506 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/video.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libmpdemux/video.c b/libmpdemux/video.c index 39a0383214..8a2f09c588 100644 --- a/libmpdemux/video.c +++ b/libmpdemux/video.c @@ -517,6 +517,7 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** ((demuxer->file_format==DEMUXER_TYPE_MPEG_PS) && (sh_video->format==0x10000005)) ){ // + int in_picture = 0; while(videobuf_len + if((i&~0x60) == 0x101 || (i&~0x60) == 0x102 || (i&~0x60) == 0x105) + // found VCL NAL with slice header i.e. start of current primary coded + // picture, so start scanning for the end now + in_picture = 1; + if (in_picture) { + i = sync_video_packet(d_video) & ~0x60; // code of next packet + if(i == 0x106 || i == 0x109) break; // SEI or access unit delim. + if(i == 0x101 || i == 0x102 || i == 0x105) { + // assuming arbitrary slice ordering is not allowed, the + // first_mb_in_slice (golomb encoded) value should be 0 then + // for the first VCL NAL in a picture + if (demux_peekc(d_video) & 0x80) + break; + } + } } *start=videobuffer; in_size=videobuf_len; videobuf_len=0;