New vu meter visualization.
[vlc/gmpfix.git] / modules / packetizer / mpegvideo.c
blobc9b49b83516efe4eaaaa1603c34c50e5eed32d4d
1 /*****************************************************************************
2 * mpegvideo.c: parse and packetize an MPEG1/2 video stream
3 *****************************************************************************
4 * Copyright (C) 2001-2006 the VideoLAN team
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Eric Petit <titer@videolan.org>
9 * Gildas Bazin <gbazin@videolan.org>
10 * Jean-Paul Saman <jpsaman #_at_# m2x dot nl>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 /*****************************************************************************
28 * Problem with this implementation:
30 * Although we should time-stamp each picture with a PTS, this isn't possible
31 * with the current implementation.
32 * The problem comes from the fact that for non-low-delay streams we can't
33 * calculate the PTS of pictures used as backward reference. Even the temporal
34 * reference number doesn't help here because all the pictures don't
35 * necessarily have the same duration (eg. 3:2 pulldown).
37 * However this doesn't really matter as far as the MPEG muxers are concerned
38 * because they allow having empty PTS fields. --gibalou
39 *****************************************************************************/
41 /*****************************************************************************
42 * Preamble
43 *****************************************************************************/
45 #ifdef HAVE_CONFIG_H
46 # include "config.h"
47 #endif
49 #include <vlc/vlc.h>
50 #include <vlc_plugin.h>
51 #include <vlc_block.h>
52 #include <vlc_codec.h>
53 #include <vlc_block_helper.h>
54 #include "../codec/cc.h"
56 #define SYNC_INTRAFRAME_TEXT N_("Sync on Intra Frame")
57 #define SYNC_INTRAFRAME_LONGTEXT N_("Normally the packetizer would " \
58 "sync on the next full frame. This flags instructs the packetizer " \
59 "to sync on the first Intra Frame found.")
61 /*****************************************************************************
62 * Module descriptor
63 *****************************************************************************/
64 static int Open ( vlc_object_t * );
65 static void Close( vlc_object_t * );
67 vlc_module_begin();
68 set_category( CAT_SOUT );
69 set_subcategory( SUBCAT_SOUT_PACKETIZER );
70 set_description( N_("MPEG-I/II video packetizer") );
71 set_capability( "packetizer", 50 );
72 set_callbacks( Open, Close );
74 add_bool( "packetizer-mpegvideo-sync-iframe", 0, NULL, SYNC_INTRAFRAME_TEXT,
75 SYNC_INTRAFRAME_LONGTEXT, true );
76 vlc_module_end();
78 /*****************************************************************************
79 * Local prototypes
80 *****************************************************************************/
81 static block_t *Packetize( decoder_t *, block_t ** );
82 static block_t *ParseMPEGBlock( decoder_t *, block_t * );
83 static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] );
85 struct decoder_sys_t
88 * Input properties
90 block_bytestream_t bytestream;
91 int i_state;
92 size_t i_offset;
93 uint8_t p_startcode[3];
95 /* Sequence header and extension */
96 block_t *p_seq;
97 block_t *p_ext;
99 /* Current frame being built */
100 block_t *p_frame;
101 block_t **pp_last;
103 bool b_frame_slice;
104 mtime_t i_pts;
105 mtime_t i_dts;
107 /* Sequence properties */
108 int i_frame_rate;
109 int i_frame_rate_base;
110 bool b_seq_progressive;
111 bool b_low_delay;
112 int i_aspect_ratio_info;
113 bool b_inited;
115 /* Picture properties */
116 int i_temporal_ref;
117 int i_picture_type;
118 int i_picture_structure;
119 int i_top_field_first;
120 int i_repeat_first_field;
121 int i_progressive_frame;
123 mtime_t i_interpolated_dts;
124 mtime_t i_last_ref_pts;
125 bool b_second_field;
127 /* Number of pictures since last sequence header */
128 int i_seq_old;
130 /* Sync behaviour */
131 bool b_sync_on_intra_frame;
132 bool b_discontinuity;
134 /* */
135 bool b_cc_reset;
136 uint32_t i_cc_flags;
137 mtime_t i_cc_pts;
138 mtime_t i_cc_dts;
139 cc_data_t cc;
142 enum {
143 STATE_NOSYNC,
144 STATE_NEXT_SYNC
147 /*****************************************************************************
148 * Open:
149 *****************************************************************************/
150 static int Open( vlc_object_t *p_this )
152 decoder_t *p_dec = (decoder_t*)p_this;
153 decoder_sys_t *p_sys;
155 if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', 'g', '1' ) &&
156 p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', 'g', '2' ) &&
157 p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', 'g', 'v' ) )
159 return VLC_EGENERIC;
162 es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC('m','p','g','v') );
163 p_dec->pf_packetize = Packetize;
164 p_dec->pf_get_cc = GetCc;
166 p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
167 if( !p_dec->p_sys )
168 return VLC_ENOMEM;
169 memset( p_dec->p_sys, 0, sizeof( decoder_sys_t ) );
171 /* Misc init */
172 p_sys->i_state = STATE_NOSYNC;
173 p_sys->bytestream = block_BytestreamInit();
174 p_sys->p_startcode[0] = 0;
175 p_sys->p_startcode[1] = 0;
176 p_sys->p_startcode[2] = 1;
177 p_sys->i_offset = 0;
179 p_sys->p_seq = NULL;
180 p_sys->p_ext = NULL;
181 p_sys->p_frame = NULL;
182 p_sys->pp_last = &p_sys->p_frame;
183 p_sys->b_frame_slice = false;
185 p_sys->i_dts = p_sys->i_pts = 0;
187 p_sys->i_frame_rate = 1;
188 p_sys->i_frame_rate_base = 1;
189 p_sys->b_seq_progressive = true;
190 p_sys->b_low_delay = true;
191 p_sys->i_seq_old = 0;
193 p_sys->i_temporal_ref = 0;
194 p_sys->i_picture_type = 0;
195 p_sys->i_picture_structure = 0x03; /* frame */
196 p_sys->i_top_field_first = 0;
197 p_sys->i_repeat_first_field = 0;
198 p_sys->i_progressive_frame = 0;
199 p_sys->b_inited = 0;
201 p_sys->i_interpolated_dts = 0;
202 p_sys->i_last_ref_pts = 0;
203 p_sys->b_second_field = 0;
205 p_sys->b_discontinuity = false;
206 p_sys->b_sync_on_intra_frame = var_CreateGetBool( p_dec, "packetizer-mpegvideo-sync-iframe" );
207 if( p_sys->b_sync_on_intra_frame )
208 msg_Dbg( p_dec, "syncing on intra frame now" );
210 p_sys->b_cc_reset = false;
211 p_sys->i_cc_pts = 0;
212 p_sys->i_cc_dts = 0;
213 p_sys->i_cc_flags = 0;
214 cc_Init( &p_sys->cc );
216 return VLC_SUCCESS;
219 /*****************************************************************************
220 * Close:
221 *****************************************************************************/
222 static void Close( vlc_object_t *p_this )
224 decoder_t *p_dec = (decoder_t*)p_this;
225 decoder_sys_t *p_sys = p_dec->p_sys;
227 block_BytestreamRelease( &p_sys->bytestream );
229 if( p_sys->p_seq )
231 block_Release( p_sys->p_seq );
233 if( p_sys->p_ext )
235 block_Release( p_sys->p_ext );
237 if( p_sys->p_frame )
239 block_ChainRelease( p_sys->p_frame );
242 var_Destroy( p_dec, "packetizer-mpegvideo-sync-iframe" );
244 free( p_sys );
247 /*****************************************************************************
248 * Packetize:
249 *****************************************************************************/
250 static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
252 decoder_sys_t *p_sys = p_dec->p_sys;
253 block_t *p_pic;
255 if( pp_block == NULL || *pp_block == NULL )
257 return NULL;
260 if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
262 if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
264 p_sys->i_state = STATE_NOSYNC;
265 block_BytestreamFlush( &p_sys->bytestream );
267 p_sys->b_discontinuity = true;
268 if( p_sys->p_frame )
269 block_ChainRelease( p_sys->p_frame );
270 p_sys->p_frame = NULL;
271 p_sys->pp_last = &p_sys->p_frame;
272 p_sys->b_frame_slice = false;
274 // p_sys->i_interpolated_dts =
275 // p_sys->i_last_ref_pts = 0;
277 block_Release( *pp_block );
278 return NULL;
282 block_BytestreamPush( &p_sys->bytestream, *pp_block );
284 while( 1 )
286 switch( p_sys->i_state )
289 case STATE_NOSYNC:
290 if( block_FindStartcodeFromOffset( &p_sys->bytestream,
291 &p_sys->i_offset, p_sys->p_startcode, 3 ) == VLC_SUCCESS )
293 p_sys->i_state = STATE_NEXT_SYNC;
296 if( p_sys->i_offset )
298 block_SkipBytes( &p_sys->bytestream, p_sys->i_offset );
299 p_sys->i_offset = 0;
300 block_BytestreamFlush( &p_sys->bytestream );
303 if( p_sys->i_state != STATE_NEXT_SYNC )
305 /* Need more data */
306 return NULL;
309 p_sys->i_offset = 1; /* To find next startcode */
311 case STATE_NEXT_SYNC:
312 /* TODO: If p_block == NULL, flush the buffer without checking the
313 * next sync word */
315 /* Find the next startcode */
316 if( block_FindStartcodeFromOffset( &p_sys->bytestream,
317 &p_sys->i_offset, p_sys->p_startcode, 3 ) != VLC_SUCCESS )
319 /* Need more data */
320 return NULL;
323 /* Get the new fragment and set the pts/dts */
324 p_pic = block_New( p_dec, p_sys->i_offset );
325 block_BytestreamFlush( &p_sys->bytestream );
326 p_pic->i_pts = p_sys->bytestream.p_block->i_pts;
327 p_pic->i_dts = p_sys->bytestream.p_block->i_dts;
329 block_GetBytes( &p_sys->bytestream, p_pic->p_buffer,
330 p_pic->i_buffer );
332 /* don't reuse the same timestamps several times */
333 if( p_pic->i_buffer >= 4 && p_pic->p_buffer[3] == 0x00 )
335 /* We have a picture start code */
336 p_sys->bytestream.p_block->i_pts = 0;
337 p_sys->bytestream.p_block->i_dts = 0;
340 p_sys->i_offset = 0;
342 /* Get picture if any */
343 if( !( p_pic = ParseMPEGBlock( p_dec, p_pic ) ) )
345 p_sys->i_state = STATE_NOSYNC;
346 break;
349 /* If a discontinuity has been encountered, then wait till
350 * the next Intra frame before continuing with packetizing */
351 if( p_sys->b_discontinuity &&
352 p_sys->b_sync_on_intra_frame )
354 if( p_pic->i_flags & BLOCK_FLAG_TYPE_I )
356 msg_Dbg( p_dec, "synced on intra frame" );
357 p_sys->b_discontinuity = false;
358 p_pic->i_flags |= BLOCK_FLAG_DISCONTINUITY;
360 else
362 msg_Dbg( p_dec, "waiting on intra frame" );
363 p_sys->i_state = STATE_NOSYNC;
364 block_Release( p_pic );
365 break;
369 /* We've just started the stream, wait for the first PTS.
370 * We discard here so we can still get the sequence header. */
371 if( p_sys->i_dts <= 0 && p_sys->i_pts <= 0 &&
372 p_sys->i_interpolated_dts <= 0 )
374 msg_Dbg( p_dec, "need a starting pts/dts" );
375 p_sys->i_state = STATE_NOSYNC;
376 block_Release( p_pic );
377 break;
380 /* When starting the stream we can have the first frame with
381 * a null DTS (i_interpolated_pts is initialized to 0) */
382 if( !p_pic->i_dts ) p_pic->i_dts = p_pic->i_pts;
384 /* So p_block doesn't get re-added several times */
385 *pp_block = block_BytestreamPop( &p_sys->bytestream );
387 p_sys->i_state = STATE_NOSYNC;
389 return p_pic;
394 /*****************************************************************************
395 * GetCc:
396 *****************************************************************************/
397 static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
399 decoder_sys_t *p_sys = p_dec->p_sys;
400 block_t *p_cc;
401 int i;
403 for( i = 0; i < 4; i++ )
404 pb_present[i] = p_sys->cc.pb_present[i];
406 if( p_sys->cc.i_data <= 0 )
407 return NULL;
409 p_cc = block_New( p_dec, p_sys->cc.i_data);
410 if( p_cc )
412 memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
413 p_cc->i_dts =
414 p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
415 p_cc->i_flags = ( p_sys->cc.b_reorder ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P ) & ( BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B);
417 cc_Flush( &p_sys->cc );
418 return p_cc;
421 /*****************************************************************************
422 * ParseMPEGBlock: Re-assemble fragments into a block containing a picture
423 *****************************************************************************/
424 static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
426 decoder_sys_t *p_sys = p_dec->p_sys;
427 block_t *p_pic = NULL;
430 * Check if previous picture is finished
432 if( ( p_sys->b_frame_slice &&
433 (p_frag->p_buffer[3] == 0x00 || p_frag->p_buffer[3] > 0xaf) ) &&
434 p_sys->p_seq == NULL )
436 /* We have a picture but without a sequence header we can't
437 * do anything */
438 msg_Dbg( p_dec, "waiting for sequence start" );
439 if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame );
440 p_sys->p_frame = NULL;
441 p_sys->pp_last = &p_sys->p_frame;
442 p_sys->b_frame_slice = false;
445 else if( p_sys->b_frame_slice &&
446 (p_frag->p_buffer[3] == 0x00 || p_frag->p_buffer[3] > 0xaf) )
448 mtime_t i_duration;
450 p_pic = block_ChainGather( p_sys->p_frame );
452 i_duration = (mtime_t)( 1000000 * p_sys->i_frame_rate_base /
453 p_sys->i_frame_rate );
455 if( !p_sys->b_seq_progressive && p_sys->i_picture_structure != 0x03 )
457 i_duration /= 2;
460 if( p_sys->b_seq_progressive )
462 if( p_sys->i_top_field_first == 0 &&
463 p_sys->i_repeat_first_field == 1 )
465 i_duration *= 2;
467 else if( p_sys->i_top_field_first == 1 &&
468 p_sys->i_repeat_first_field == 1 )
470 i_duration *= 3;
473 else
475 if( p_sys->i_picture_structure == 0x03 )
477 if( p_sys->i_progressive_frame && p_sys->i_repeat_first_field )
479 i_duration += i_duration / 2;
484 if( p_sys->b_low_delay || p_sys->i_picture_type == 0x03 )
486 /* Trivial case (DTS == PTS) */
487 /* Correct interpolated dts when we receive a new pts/dts */
488 if( p_sys->i_pts > 0 ) p_sys->i_interpolated_dts = p_sys->i_pts;
489 if( p_sys->i_dts > 0 ) p_sys->i_interpolated_dts = p_sys->i_dts;
491 else
493 /* Correct interpolated dts when we receive a new pts/dts */
494 if( p_sys->i_last_ref_pts > 0 && !p_sys->b_second_field )
495 p_sys->i_interpolated_dts = p_sys->i_last_ref_pts;
496 if( p_sys->i_dts > 0 ) p_sys->i_interpolated_dts = p_sys->i_dts;
498 if( !p_sys->b_second_field )
499 p_sys->i_last_ref_pts = p_sys->i_pts;
502 p_pic->i_dts = p_sys->i_interpolated_dts;
503 p_sys->i_interpolated_dts += i_duration;
505 /* Set PTS only if we have a B frame or if it comes from the stream */
506 if( p_sys->i_pts > 0 )
508 p_pic->i_pts = p_sys->i_pts;
510 else if( p_sys->i_picture_type == 0x03 )
512 p_pic->i_pts = p_pic->i_dts;
514 else
516 p_pic->i_pts = 0;
519 switch ( p_sys->i_picture_type )
521 case 0x01:
522 p_pic->i_flags |= BLOCK_FLAG_TYPE_I;
523 break;
524 case 0x02:
525 p_pic->i_flags |= BLOCK_FLAG_TYPE_P;
526 break;
527 case 0x03:
528 p_pic->i_flags |= BLOCK_FLAG_TYPE_B;
529 break;
532 p_pic->i_length = p_sys->i_interpolated_dts - p_pic->i_dts;
534 #if 0
535 msg_Dbg( p_dec, "pic: type=%d dts=%"PRId64" pts-dts=%"PRId64,
536 p_sys->i_picture_type, p_pic->i_dts, p_pic->i_pts - p_pic->i_dts);
537 #endif
539 /* Reset context */
540 p_sys->p_frame = NULL;
541 p_sys->pp_last = &p_sys->p_frame;
542 p_sys->b_frame_slice = false;
544 if( p_sys->i_picture_structure != 0x03 )
546 p_sys->b_second_field = !p_sys->b_second_field;
548 else
550 p_sys->b_second_field = 0;
553 /* CC */
554 p_sys->b_cc_reset = true;
555 p_sys->i_cc_pts = p_pic->i_pts;
556 p_sys->i_cc_dts = p_pic->i_dts;
557 p_sys->i_cc_flags = p_pic->i_flags;
560 if( !p_pic && p_sys->b_cc_reset )
562 p_sys->b_cc_reset = false;
563 cc_Flush( &p_sys->cc );
567 * Check info of current fragment
569 if( p_frag->p_buffer[3] == 0xb8 )
571 /* Group start code */
572 if( p_sys->p_seq &&
573 p_sys->i_seq_old > p_sys->i_frame_rate/p_sys->i_frame_rate_base )
575 /* Usefull for mpeg1: repeat sequence header every second */
576 block_ChainLastAppend( &p_sys->pp_last, block_Duplicate( p_sys->p_seq ) );
577 if( p_sys->p_ext )
579 block_ChainLastAppend( &p_sys->pp_last, block_Duplicate( p_sys->p_ext ) );
582 p_sys->i_seq_old = 0;
585 else if( p_frag->p_buffer[3] == 0xb3 && p_frag->i_buffer >= 8 )
587 /* Sequence header code */
588 static const int code_to_frame_rate[16][2] =
590 { 1, 1 }, /* invalid */
591 { 24000, 1001 }, { 24, 1 }, { 25, 1 }, { 30000, 1001 },
592 { 30, 1 }, { 50, 1 }, { 60000, 1001 }, { 60, 1 },
593 /* Unofficial 15fps from Xing*/
594 { 15, 1001 },
595 /* Unofficial economy rates from libmpeg3 */
596 { 5, 1001 }, { 10, 1001 }, { 12, 1001 }, { 15, 1001 },
597 { 1, 1 }, { 1, 1 } /* invalid */
600 if( p_sys->p_seq ) block_Release( p_sys->p_seq );
601 if( p_sys->p_ext ) block_Release( p_sys->p_ext );
603 p_sys->p_seq = block_Duplicate( p_frag );
604 p_sys->i_seq_old = 0;
605 p_sys->p_ext = NULL;
607 p_dec->fmt_out.video.i_width =
608 ( p_frag->p_buffer[4] << 4)|(p_frag->p_buffer[5] >> 4 );
609 p_dec->fmt_out.video.i_height =
610 ( (p_frag->p_buffer[5]&0x0f) << 8 )|p_frag->p_buffer[6];
611 p_sys->i_aspect_ratio_info = p_frag->p_buffer[7] >> 4;
613 /* TODO: MPEG1 aspect ratio */
615 p_sys->i_frame_rate = code_to_frame_rate[p_frag->p_buffer[7]&0x0f][0];
616 p_sys->i_frame_rate_base =
617 code_to_frame_rate[p_frag->p_buffer[7]&0x0f][1];
619 p_dec->fmt_out.video.i_frame_rate = p_sys->i_frame_rate;
620 p_dec->fmt_out.video.i_frame_rate_base = p_sys->i_frame_rate_base;
622 p_sys->b_seq_progressive = true;
623 p_sys->b_low_delay = true;
625 if ( !p_sys->b_inited )
627 msg_Dbg( p_dec, "size %dx%d fps=%.3f",
628 p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_height,
629 p_sys->i_frame_rate / (float)p_sys->i_frame_rate_base );
630 p_sys->b_inited = 1;
633 else if( p_frag->p_buffer[3] == 0xb5 )
635 int i_type = p_frag->p_buffer[4] >> 4;
637 /* Extension start code */
638 if( i_type == 0x01 )
640 #if 0
641 static const int mpeg2_aspect[16][2] =
643 {0,1}, {1,1}, {4,3}, {16,9}, {221,100},
644 {0,1}, {0,1}, {0,1}, {0,1}, {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
645 {0,1}, {0,1}
647 #endif
649 /* sequence extension */
650 if( p_sys->p_ext) block_Release( p_sys->p_ext );
651 p_sys->p_ext = block_Duplicate( p_frag );
653 if( p_frag->i_buffer >= 10 )
655 p_sys->b_seq_progressive =
656 p_frag->p_buffer[5]&0x08 ? true : false;
657 p_sys->b_low_delay =
658 p_frag->p_buffer[9]&0x80 ? true : false;
661 /* Do not set aspect ratio : in case we're transcoding,
662 * transcode will take our fmt_out as a fmt_in to libmpeg2.
663 * libmpeg2.c will then believe that the user has requested
664 * a specific aspect ratio, which she hasn't. Thus in case
665 * of aspect ratio change, we're screwed. --Meuuh
667 #if 0
668 p_dec->fmt_out.video.i_aspect =
669 mpeg2_aspect[p_sys->i_aspect_ratio_info][0] *
670 VOUT_ASPECT_FACTOR /
671 mpeg2_aspect[p_sys->i_aspect_ratio_info][1];
672 #endif
675 else if( i_type == 0x08 )
677 /* picture extension */
678 p_sys->i_picture_structure = p_frag->p_buffer[6]&0x03;
679 p_sys->i_top_field_first = p_frag->p_buffer[7] >> 7;
680 p_sys->i_repeat_first_field= (p_frag->p_buffer[7]>>1)&0x01;
681 p_sys->i_progressive_frame = p_frag->p_buffer[8] >> 7;
684 else if( p_frag->p_buffer[3] == 0xb2 && p_frag->i_buffer > 4 )
686 cc_Extract( &p_sys->cc, &p_frag->p_buffer[4], p_frag->i_buffer - 4 );
688 else if( p_frag->p_buffer[3] == 0x00 )
690 /* Picture start code */
691 p_sys->i_seq_old++;
693 if( p_frag->i_buffer >= 6 )
695 p_sys->i_temporal_ref =
696 ( p_frag->p_buffer[4] << 2 )|(p_frag->p_buffer[5] >> 6);
697 p_sys->i_picture_type = ( p_frag->p_buffer[5] >> 3 ) & 0x03;
700 p_sys->i_dts = p_frag->i_dts;
701 p_sys->i_pts = p_frag->i_pts;
703 else if( p_frag->p_buffer[3] >= 0x01 && p_frag->p_buffer[3] <= 0xaf )
705 /* Slice start code */
706 p_sys->b_frame_slice = true;
709 /* Append the block */
710 block_ChainLastAppend( &p_sys->pp_last, p_frag );
712 return p_pic;