1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 18:05:21 +00:00

simplify flags

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17719 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2006-03-03 22:30:17 +00:00
parent 99cb97975c
commit 608b2793cd

View File

@ -131,8 +131,6 @@ main header:
for(i=0; i<256; ){ for(i=0; i<256; ){
tmp_flag v tmp_flag v
tmp_fields v tmp_fields v
if(tmp_fields>0) tmp_sflag v
else tmp_sflag=0
if(tmp_fields>1) tmp_pts s if(tmp_fields>1) tmp_pts s
if(tmp_fields>2) tmp_mul v if(tmp_fields>2) tmp_mul v
if(tmp_fields>3) tmp_stream v if(tmp_fields>3) tmp_stream v
@ -147,12 +145,11 @@ main header:
} }
for(j=0; j<count && i<256; j++, i++){ for(j=0; j<count && i<256; j++, i++){
if (i == 'N') { if (i == 'N') {
flags[i]= 4; flags[i]= FLAG_INVALID;
j--; j--;
continue; continue;
} }
flags[i]= tmp_flag; flags[i]= tmp_flag;
stream_flags[i]= tmp_sflag;
stream_id_plus1[i]= tmp_stream; stream_id_plus1[i]= tmp_stream;
data_size_mul[i]= tmp_mul; data_size_mul[i]= tmp_mul;
data_size_lsb[i]= tmp_size + j; data_size_lsb[i]= tmp_size + j;
@ -195,15 +192,17 @@ frame:
if(pts_delta[frame_code]==0){ if(pts_delta[frame_code]==0){
coded_pts v coded_pts v
} }
if(flags[frame_code]&1){ frame_flags= flags[frame_code]
data_size_msb v if(frame_flags&FLAG_CODED){
coded_flags v
frame_flags ^= coded_flags
} }
if(flags[frame_code]&2){ if(frame_flags&FLAG_SIZE_MSB){
coded_stream_flags v data_size_msb v
} }
for(i=0; i<reserved_count[frame_code]; i++) for(i=0; i<reserved_count[frame_code]; i++)
reserved v reserved v
if(stream_flags&4){ if(frame_flagsFLAG_CHECKSUM){
checksum u(32) checksum u(32)
} }
data data
@ -494,21 +493,16 @@ frame_code
the value 78 ('N') is forbidden to ensure that the byte is always the value 78 ('N') is forbidden to ensure that the byte is always
different from the first byte of any startcode different from the first byte of any startcode
flags[frame_code] flags[frame_code], frame_flags
Bit Name Description Bit Name Description
1 data_size_msb if set, data_size_msb is at frame header, 1 FLAG_SIZE_MSB if set, data_size_msb is at frame header,
otherwise data_size_msb is 0 otherwise data_size_msb is 0
2 more_flags if set, stream control flags are at frame header. 2 FLAG_CHECKSUM if set then the frame header contains a checksum
4 invalid if set, frame_code is invalid. 4 FLAG_KEY if set, frame is keyframe
8 FLAG_EOR if set, stream has no relevance on
stream_flags
stream_flags is "stream_flags[frame_code] ^ coded_stream_flags"
Bit Name Description
1 is_key if set, frame is keyframe
2 end_of_relevance if set, stream has no relevance on
presentation. (EOR) presentation. (EOR)
4 has_checksum if set then the frame header contains a checksum 256 FLAG_CODED if set, coded_flags are stored in the frame header.
512 FLAG_INVALID if set, frame_code is invalid.
EOR frames MUST be zero-length and must be set keyframe. EOR frames MUST be zero-length and must be set keyframe.
All streams SHOULD end with EOR, where the pts of the EOR indicates the All streams SHOULD end with EOR, where the pts of the EOR indicates the