| 1 |
|
| /* |
| 2 |
|
| * dump_state.c |
| 3 |
|
| * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> |
| 4 |
|
| * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> |
| 5 |
|
| * |
| 6 |
|
| * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. |
| 7 |
|
| * See http://libmpeg2.sourceforge.net/ for updates. |
| 8 |
|
| * |
| 9 |
|
| * mpeg2dec is free software; you can redistribute it and/or modify |
| 10 |
|
| * it under the terms of the GNU General Public License as published by |
| 11 |
|
| * the Free Software Foundation; either version 2 of the License, or |
| 12 |
|
| * (at your option) any later version. |
| 13 |
|
| * |
| 14 |
|
| * mpeg2dec is distributed in the hope that it will be useful, |
| 15 |
|
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
|
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
|
| * GNU General Public License for more details. |
| 18 |
|
| * |
| 19 |
|
| * You should have received a copy of the GNU General Public License |
| 20 |
|
| * along with this program; if not, write to the Free Software |
| 21 |
|
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 |
|
| */ |
| 23 |
|
| |
| 24 |
|
| #include "config.h" |
| 25 |
|
| |
| 26 |
|
| #include <stdio.h> |
| 27 |
|
| #include <string.h> |
| 28 |
|
| #include <inttypes.h> |
| 29 |
|
| |
| 30 |
|
| #include "mpeg2.h" |
| 31 |
|
| |
| 32 |
|
| void dump_state (FILE * f, mpeg2_state_t state, const mpeg2_info_t * info, |
| 33 |
|
| int offset, int verbose); |
| 34 |
|
| |
| 35 |
|
| static struct { |
| 36 |
|
| const mpeg2_sequence_t * ptr; |
| 37 |
|
| mpeg2_sequence_t value; |
| 38 |
|
| } last_sequence; |
| 39 |
|
| static struct { |
| 40 |
|
| const mpeg2_gop_t * ptr; |
| 41 |
|
| mpeg2_gop_t value; |
| 42 |
|
| } last_gop; |
| 43 |
|
| static struct save_buf { |
| 44 |
|
| const mpeg2_fbuf_t * ptr; |
| 45 |
|
| mpeg2_fbuf_t value; |
| 46 |
|
| } last_curbuf, last_dispbuf, last_discbuf, buf_code_list[26]; |
| 47 |
|
| static int buf_code_index = 0; |
| 48 |
|
| static int buf_code_new = -1; |
| 49 |
|
| static struct save_pic { |
| 50 |
|
| const mpeg2_picture_t * ptr; |
| 51 |
|
| mpeg2_picture_t value; |
| 52 |
|
| } last_curpic, last_curpic2, last_disppic, last_disppic2, pic_code_list[26]; |
| 53 |
|
| static int pic_code_index = 0; |
| 54 |
|
| static int pic_code_new = -1; |
| 55 |
|
| |
| 56 |
0 |
| static int sequence_match (const mpeg2_sequence_t * seq) |
| 57 |
|
| { |
| 58 |
0 |
▶ | return (last_sequence.ptr == seq && |
Branch: 2 branches
| Branch | True | False | Total |
| return (last_sequence.ptr == seq && |
0 |
0 |
0 |
| return (last_sequence.ptr == seq && |
0 |
0 |
0 |
|
| 59 |
0 |
| (seq == NULL || |
| 60 |
0 |
▶ | !memcmp (seq, &last_sequence.value, sizeof (mpeg2_sequence_t)))); |
Branch: 1 branch
| Branch | True | False | Total |
| !memcmp (seq, &last_sequence.value, sizeof (mpeg2_sequence_t)))); |
0 |
0 |
0 |
|
| 61 |
|
| } |
| 62 |
|
| |
| 63 |
0 |
| static void sequence_save (const mpeg2_sequence_t * seq) |
| 64 |
|
| { |
| 65 |
0 |
| last_sequence.ptr = seq; |
| 66 |
0 |
▶ | if (seq != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq != NULL) |
0 |
0 |
0 |
|
| 67 |
0 |
| last_sequence.value = *seq; |
| 68 |
0 |
| } |
| 69 |
|
| |
| 70 |
0 |
| static char seq_code (const mpeg2_sequence_t * seq) |
| 71 |
|
| { |
| 72 |
0 |
▶ | if (seq == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq == NULL) |
0 |
0 |
0 |
|
| 73 |
0 |
| return '-'; |
| 74 |
0 |
▶ | else if (sequence_match (seq)) |
Branch: 1 branch
| Branch | True | False | Total |
| else if (sequence_match (seq)) |
0 |
0 |
0 |
|
| 75 |
0 |
| return 'S'; |
| 76 |
|
| else |
| 77 |
0 |
| return '?'; |
| 78 |
|
| } |
| 79 |
|
| |
| 80 |
0 |
| static int gop_match (const mpeg2_gop_t * gop) |
| 81 |
|
| { |
| 82 |
0 |
▶ | return (last_gop.ptr == gop && |
Branch: 2 branches
| Branch | True | False | Total |
| return (last_gop.ptr == gop && |
0 |
0 |
0 |
| return (last_gop.ptr == gop && |
0 |
0 |
0 |
|
| 83 |
0 |
| (gop == NULL || |
| 84 |
0 |
▶ | !memcmp (gop, &last_gop.value, sizeof (mpeg2_gop_t)))); |
Branch: 1 branch
| Branch | True | False | Total |
| !memcmp (gop, &last_gop.value, sizeof (mpeg2_gop_t)))); |
0 |
0 |
0 |
|
| 85 |
|
| } |
| 86 |
|
| |
| 87 |
0 |
| static void gop_save (const mpeg2_gop_t * gop) |
| 88 |
|
| { |
| 89 |
0 |
| last_gop.ptr = gop; |
| 90 |
0 |
▶ | if (gop != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (gop != NULL) |
0 |
0 |
0 |
|
| 91 |
0 |
| last_gop.value = *gop; |
| 92 |
0 |
| } |
| 93 |
|
| |
| 94 |
0 |
| static char gop_code (const mpeg2_gop_t * gop) |
| 95 |
|
| { |
| 96 |
0 |
▶ | if (gop == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (gop == NULL) |
0 |
0 |
0 |
|
| 97 |
0 |
| return '-'; |
| 98 |
0 |
▶ | else if (gop_match (gop)) |
Branch: 1 branch
| Branch | True | False | Total |
| else if (gop_match (gop)) |
0 |
0 |
0 |
|
| 99 |
0 |
| return 'G'; |
| 100 |
|
| else |
| 101 |
0 |
| return '?'; |
| 102 |
|
| } |
| 103 |
|
| |
| 104 |
0 |
| static int fbuf_match (const mpeg2_fbuf_t * fbuf, struct save_buf * saved) |
| 105 |
|
| { |
| 106 |
0 |
▶ | return (saved->ptr == fbuf && |
Branch: 2 branches
| Branch | True | False | Total |
| return (saved->ptr == fbuf && |
0 |
0 |
0 |
| return (saved->ptr == fbuf && |
0 |
0 |
0 |
|
| 107 |
0 |
| (fbuf == NULL || |
| 108 |
0 |
▶ | !memcmp (fbuf, &saved->value, sizeof (mpeg2_fbuf_t)))); |
Branch: 1 branch
| Branch | True | False | Total |
| !memcmp (fbuf, &saved->value, sizeof (mpeg2_fbuf_t)))); |
0 |
0 |
0 |
|
| 109 |
|
| } |
| 110 |
|
| |
| 111 |
0 |
| static void fbuf_save (const mpeg2_fbuf_t * fbuf, struct save_buf * saved) |
| 112 |
|
| { |
| 113 |
0 |
| saved->ptr = fbuf; |
| 114 |
0 |
▶ | if (fbuf != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (fbuf != NULL) |
0 |
0 |
0 |
|
| 115 |
0 |
| saved->value = *fbuf; |
| 116 |
0 |
| } |
| 117 |
|
| |
| 118 |
0 |
| static char buf_code (const mpeg2_fbuf_t * fbuf) |
| 119 |
|
| { |
| 120 |
|
| int i; |
| 121 |
|
| |
| 122 |
0 |
▶ | if (fbuf == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (fbuf == NULL) |
0 |
0 |
0 |
|
| 123 |
0 |
| return '-'; |
| 124 |
0 |
▶ | for (i = 0; i < 26; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 26; i++) |
0 |
0 |
0 |
|
| 125 |
0 |
▶ | if (fbuf_match (fbuf, buf_code_list + i)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (fbuf_match (fbuf, buf_code_list + i)) |
0 |
0 |
0 |
|
| 126 |
0 |
▶ | return ((i == buf_code_new) ? 'A' : 'a') + i; |
Branch: 1 branch
| Branch | True | False | Total |
| return ((i == buf_code_new) ? 'A' : 'a') + i; |
0 |
0 |
0 |
|
| 127 |
0 |
| return '?'; |
| 128 |
|
| } |
| 129 |
|
| |
| 130 |
0 |
| static void buf_code_add (const mpeg2_fbuf_t * fbuf, FILE * f) |
| 131 |
|
| { |
| 132 |
|
| int i; |
| 133 |
|
| |
| 134 |
0 |
▶ | if (fbuf == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (fbuf == NULL) |
0 |
0 |
0 |
|
| 135 |
0 |
| fprintf (f, "buf_code_add error\n"); |
| 136 |
0 |
▶ | for (i = 0; i < 26; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 26; i++) |
0 |
0 |
0 |
|
| 137 |
0 |
▶ | if (buf_code_list[i].ptr == fbuf) |
Branch: 1 branch
| Branch | True | False | Total |
| if (buf_code_list[i].ptr == fbuf) |
0 |
0 |
0 |
|
| 138 |
0 |
| fprintf (f, "buf_code_add error\n"); |
| 139 |
0 |
| buf_code_new = buf_code_index; |
| 140 |
0 |
| fbuf_save (fbuf, buf_code_list + buf_code_index); |
| 141 |
0 |
▶ | if (++buf_code_index == 26) |
Branch: 1 branch
| Branch | True | False | Total |
| if (++buf_code_index == 26) |
0 |
0 |
0 |
|
| 142 |
0 |
| buf_code_index = 0; |
| 143 |
0 |
| } |
| 144 |
|
| |
| 145 |
0 |
| static void buf_code_del (const mpeg2_fbuf_t * fbuf) |
| 146 |
|
| { |
| 147 |
|
| int i; |
| 148 |
|
| |
| 149 |
0 |
▶ | if (fbuf == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (fbuf == NULL) |
0 |
0 |
0 |
|
| 150 |
0 |
| return; |
| 151 |
0 |
▶ | for (i = 0; i < 26; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 26; i++) |
0 |
0 |
0 |
|
| 152 |
0 |
▶ | if (fbuf_match (fbuf, buf_code_list + i)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (fbuf_match (fbuf, buf_code_list + i)) { |
0 |
0 |
0 |
|
| 153 |
0 |
| buf_code_list[i].ptr = NULL; |
| 154 |
0 |
| return; |
| 155 |
|
| } |
| 156 |
|
| } |
| 157 |
|
| |
| 158 |
0 |
| static int picture_match (const mpeg2_picture_t * pic, struct save_pic * saved) |
| 159 |
|
| { |
| 160 |
0 |
▶ | return (saved->ptr == pic && |
Branch: 2 branches
| Branch | True | False | Total |
| return (saved->ptr == pic && |
0 |
0 |
0 |
| return (saved->ptr == pic && |
0 |
0 |
0 |
|
| 161 |
0 |
| (pic == NULL || |
| 162 |
0 |
▶ | !memcmp (pic, &saved->value, sizeof (mpeg2_picture_t)))); |
Branch: 1 branch
| Branch | True | False | Total |
| !memcmp (pic, &saved->value, sizeof (mpeg2_picture_t)))); |
0 |
0 |
0 |
|
| 163 |
|
| } |
| 164 |
|
| |
| 165 |
0 |
| static void picture_save (const mpeg2_picture_t * pic, struct save_pic * saved) |
| 166 |
|
| { |
| 167 |
0 |
| saved->ptr = pic; |
| 168 |
0 |
▶ | if (pic != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic != NULL) |
0 |
0 |
0 |
|
| 169 |
0 |
| saved->value = *pic; |
| 170 |
0 |
| } |
| 171 |
|
| |
| 172 |
0 |
| static char pic_code (const mpeg2_picture_t * pic) |
| 173 |
|
| { |
| 174 |
|
| int i; |
| 175 |
|
| |
| 176 |
0 |
▶ | if (pic == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic == NULL) |
0 |
0 |
0 |
|
| 177 |
0 |
| return '-'; |
| 178 |
0 |
▶ | for (i = 0; i < 26; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 26; i++) |
0 |
0 |
0 |
|
| 179 |
0 |
▶ | if (picture_match (pic, pic_code_list + i)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (picture_match (pic, pic_code_list + i)) |
0 |
0 |
0 |
|
| 180 |
0 |
▶ | return ((i == pic_code_new) ? 'A' : 'a') + i; |
Branch: 1 branch
| Branch | True | False | Total |
| return ((i == pic_code_new) ? 'A' : 'a') + i; |
0 |
0 |
0 |
|
| 181 |
0 |
| return '?'; |
| 182 |
|
| } |
| 183 |
|
| |
| 184 |
0 |
| static void pic_code_add (const mpeg2_picture_t * pic, FILE * f) |
| 185 |
|
| { |
| 186 |
|
| int i; |
| 187 |
|
| |
| 188 |
0 |
▶ | if (pic == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic == NULL) |
0 |
0 |
0 |
|
| 189 |
0 |
| fprintf (f, "pic_code_add error\n"); |
| 190 |
0 |
▶ | for (i = 0; i < 26; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 26; i++) |
0 |
0 |
0 |
|
| 191 |
0 |
▶ | if (pic_code_list[i].ptr == pic) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic_code_list[i].ptr == pic) |
0 |
0 |
0 |
|
| 192 |
0 |
| fprintf (f, "pic_code_add error\n"); |
| 193 |
0 |
| pic_code_new = pic_code_index; |
| 194 |
0 |
| picture_save (pic, pic_code_list + pic_code_index); |
| 195 |
0 |
▶ | if (++pic_code_index == 26) |
Branch: 1 branch
| Branch | True | False | Total |
| if (++pic_code_index == 26) |
0 |
0 |
0 |
|
| 196 |
0 |
| pic_code_index = 0; |
| 197 |
0 |
| } |
| 198 |
|
| |
| 199 |
0 |
| static void pic_code_del (const mpeg2_picture_t * pic) |
| 200 |
|
| { |
| 201 |
|
| int i; |
| 202 |
|
| |
| 203 |
0 |
▶ | if (pic == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic == NULL) |
0 |
0 |
0 |
|
| 204 |
0 |
| return; |
| 205 |
0 |
▶ | for (i = 0; i < 26; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 26; i++) |
0 |
0 |
0 |
|
| 206 |
0 |
▶ | if (picture_match (pic, pic_code_list + i)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (picture_match (pic, pic_code_list + i)) { |
0 |
0 |
0 |
|
| 207 |
0 |
| pic_code_list[i].ptr = NULL; |
| 208 |
0 |
| return; |
| 209 |
|
| } |
| 210 |
|
| } |
| 211 |
|
| |
| 212 |
0 |
| void dump_state (FILE * f, mpeg2_state_t state, const mpeg2_info_t * info, |
| 213 |
|
| int offset, int verbose) |
| 214 |
|
| { |
| 215 |
|
| static const char * state_name[] = { |
| 216 |
|
| "BUFFER", "SEQUENCE", "SEQUENCE_REPEATED","GOP", |
| 217 |
|
| "PICTURE", "SLICE_1ST", "PICTURE_2ND", "SLICE", "END", |
| 218 |
|
| "INVALID", "INVALID_END", "SEQUENCE_MODIFIED" |
| 219 |
|
| }; |
| 220 |
|
| static const char * profile[] = { "HP", "Spatial", "SNR", "MP", "SP" }; |
| 221 |
|
| static const char * level[] = { "HL", "H-14", "ML", "LL" }; |
| 222 |
|
| static const char * profile2[] = { "422@HL", NULL, NULL, "422@ML", |
| 223 |
|
| NULL, NULL, NULL, NULL, "MV@HL", |
| 224 |
|
| "MV@H-14", NULL, "MV@ML", "MV@LL" }; |
| 225 |
|
| static const char * video_fmt[] = { "COMPONENT", "PAL", "NTSC", "SECAM", "MAC"}; |
| 226 |
|
| static const char coding_type[] = { '0', 'I', 'P', 'B', 'D', '5', '6', '7'}; |
| 227 |
|
| static const char * colour[] = { NULL, "BT.709", "UNSPECIFIED", NULL, |
| 228 |
|
| "BT.470-2/M", "BT.470-2/B,G", |
| 229 |
|
| "SMPTE170M", "SMPTE240M", "LINEAR" }; |
| 230 |
|
| static const char * colour3[] = { NULL, "BT.709", "UNSPEC_COLORS", NULL, NULL, |
| 231 |
|
| "BT.470-2/B,G", "SMPTE170M", "SMPTE240M" }; |
| 232 |
0 |
| const mpeg2_sequence_t * seq = info->sequence; |
| 233 |
0 |
| const mpeg2_gop_t * gop = info->gop; |
| 234 |
|
| const mpeg2_picture_t * pic; |
| 235 |
|
| unsigned int i, nb_pos, pixel_width, pixel_height; |
| 236 |
|
| |
| 237 |
0 |
| if (state == STATE_BUFFER && |
| 238 |
0 |
▶ | sequence_match (seq) && gop_match (gop) && |
Branch: 1 branch
| Branch | True | False | Total |
| sequence_match (seq) && gop_match (gop) && |
0 |
0 |
0 |
|
| 239 |
0 |
▶ | info->user_data == NULL && info->user_data_len == 0 && |
Branch: 1 branch
| Branch | True | False | Total |
| info->user_data == NULL && info->user_data_len == 0 && |
0 |
0 |
0 |
|
| 240 |
0 |
▶ | fbuf_match (info->current_fbuf, &last_curbuf) && |
Branch: 1 branch
| Branch | True | False | Total |
| fbuf_match (info->current_fbuf, &last_curbuf) && |
0 |
0 |
0 |
|
| 241 |
0 |
▶ | fbuf_match (info->display_fbuf, &last_dispbuf) && |
Branch: 1 branch
| Branch | True | False | Total |
| fbuf_match (info->display_fbuf, &last_dispbuf) && |
0 |
0 |
0 |
|
| 242 |
0 |
▶ | fbuf_match (info->discard_fbuf, &last_discbuf) && |
Branch: 1 branch
| Branch | True | False | Total |
| fbuf_match (info->discard_fbuf, &last_discbuf) && |
0 |
0 |
0 |
|
| 243 |
0 |
▶ | picture_match (info->current_picture, &last_curpic) && |
Branch: 1 branch
| Branch | True | False | Total |
| picture_match (info->current_picture, &last_curpic) && |
0 |
0 |
0 |
|
| 244 |
0 |
▶ | picture_match (info->current_picture_2nd, &last_curpic2) && |
Branch: 1 branch
| Branch | True | False | Total |
| picture_match (info->current_picture_2nd, &last_curpic2) && |
0 |
0 |
0 |
|
| 245 |
0 |
▶ | picture_match (info->display_picture, &last_disppic) && |
Branch: 1 branch
| Branch | True | False | Total |
| picture_match (info->display_picture, &last_disppic) && |
0 |
0 |
0 |
|
| 246 |
0 |
| picture_match (info->display_picture_2nd, &last_disppic2)) |
| 247 |
0 |
| return; |
| 248 |
0 |
| fprintf (f, "%8x", offset); |
| 249 |
0 |
▶ | if (verbose > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (verbose > 1) { |
0 |
0 |
0 |
|
| 250 |
0 |
| switch (state) { |
| 251 |
0 |
| case STATE_PICTURE: |
| 252 |
0 |
| buf_code_add (info->current_fbuf, f); |
| 253 |
0 |
| pic_code_add (info->current_picture, f); |
| 254 |
0 |
| break; |
| 255 |
0 |
| case STATE_PICTURE_2ND: |
| 256 |
0 |
| pic_code_add (info->current_picture_2nd, f); |
| 257 |
0 |
| break; |
| 258 |
0 |
| case STATE_SEQUENCE_MODIFIED: |
| 259 |
0 |
▶ | if (last_sequence.value.width != seq->width || |
Branch: 1 branch
| Branch | True | False | Total |
| if (last_sequence.value.width != seq->width || |
0 |
0 |
0 |
|
| 260 |
0 |
▶ | last_sequence.value.height != seq->height || |
Branch: 1 branch
| Branch | True | False | Total |
| last_sequence.value.height != seq->height || |
0 |
0 |
0 |
|
| 261 |
0 |
▶ | last_sequence.value.chroma_width != seq->chroma_width || |
Branch: 1 branch
| Branch | True | False | Total |
| last_sequence.value.chroma_width != seq->chroma_width || |
0 |
0 |
0 |
|
| 262 |
0 |
▶ | last_sequence.value.chroma_height != seq->chroma_height || |
Branch: 1 branch
| Branch | True | False | Total |
| last_sequence.value.chroma_height != seq->chroma_height || |
0 |
0 |
0 |
|
| 263 |
0 |
| ((last_sequence.value.flags & SEQ_FLAG_LOW_DELAY) != |
| 264 |
0 |
▶ | (seq->flags & SEQ_FLAG_LOW_DELAY))) |
Branch: 1 branch
| Branch | True | False | Total |
| (seq->flags & SEQ_FLAG_LOW_DELAY))) |
0 |
0 |
0 |
|
| 265 |
0 |
| fprintf (f, " (INVALID)"); |
| 266 |
|
| case STATE_SEQUENCE: |
| 267 |
0 |
| sequence_save (seq); |
| 268 |
0 |
| break; |
| 269 |
|
| break; |
| 270 |
0 |
| case STATE_GOP: |
| 271 |
0 |
| gop_save (gop); |
| 272 |
0 |
| break; |
| 273 |
0 |
| default: |
| 274 |
0 |
| break; |
| 275 |
|
| } |
| 276 |
0 |
| fprintf (f, " %c%c %c%c%c %c%c%c %c", seq_code (seq), gop_code (gop), |
| 277 |
0 |
| buf_code (info->current_fbuf), |
| 278 |
0 |
| pic_code (info->current_picture), |
| 279 |
0 |
| pic_code (info->current_picture_2nd), |
| 280 |
0 |
| buf_code (info->display_fbuf), |
| 281 |
0 |
| pic_code (info->display_picture), |
| 282 |
0 |
| pic_code (info->display_picture_2nd), |
| 283 |
0 |
| buf_code (info->discard_fbuf)); |
| 284 |
0 |
▶ | if (state == STATE_SLICE || state == STATE_END || |
Branch: 3 branches
| Branch | True | False | Total |
| if (state == STATE_SLICE || state == STATE_END || |
0 |
0 |
0 |
| if (state == STATE_SLICE || state == STATE_END || |
0 |
0 |
0 |
| if (state == STATE_SLICE || state == STATE_END || |
0 |
0 |
0 |
|
| 285 |
|
| state == STATE_INVALID_END) { |
| 286 |
0 |
▶ | if (state != STATE_SLICE) |
Branch: 1 branch
| Branch | True | False | Total |
| if (state != STATE_SLICE) |
0 |
0 |
0 |
|
| 287 |
0 |
| buf_code_del (info->display_fbuf); |
| 288 |
0 |
| buf_code_del (info->discard_fbuf); |
| 289 |
0 |
| pic_code_del (info->display_picture); |
| 290 |
0 |
| pic_code_del (info->display_picture_2nd); |
| 291 |
|
| } |
| 292 |
0 |
| buf_code_new = pic_code_new = -1; |
| 293 |
|
| } |
| 294 |
0 |
| fprintf (f, " %s", state_name[state]); |
| 295 |
0 |
| switch (state) { |
| 296 |
0 |
| case STATE_SEQUENCE: |
| 297 |
|
| case STATE_SEQUENCE_REPEATED: |
| 298 |
|
| case STATE_SEQUENCE_MODIFIED: |
| 299 |
0 |
▶ | if (seq->flags & SEQ_FLAG_MPEG2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->flags & SEQ_FLAG_MPEG2) |
0 |
0 |
0 |
|
| 300 |
0 |
| fprintf (f, " MPEG2"); |
| 301 |
0 |
▶ | if (0x10 <= seq->profile_level_id && seq->profile_level_id < 0x60 && |
Branch: 2 branches
| Branch | True | False | Total |
| if (0x10 <= seq->profile_level_id && seq->profile_level_id < 0x60 && |
0 |
0 |
0 |
| if (0x10 <= seq->profile_level_id && seq->profile_level_id < 0x60 && |
0 |
0 |
0 |
|
| 302 |
0 |
▶ | !(seq->profile_level_id & 1) && |
Branch: 1 branch
| Branch | True | False | Total |
| !(seq->profile_level_id & 1) && |
0 |
0 |
0 |
|
| 303 |
0 |
▶ | 4 <= (seq->profile_level_id & 15) && |
Branch: 1 branch
| Branch | True | False | Total |
| 4 <= (seq->profile_level_id & 15) && |
0 |
0 |
0 |
|
| 304 |
0 |
▶ | (seq->profile_level_id & 15) <= 10) |
Branch: 1 branch
| Branch | True | False | Total |
| (seq->profile_level_id & 15) <= 10) |
0 |
0 |
0 |
|
| 305 |
0 |
| fprintf (f, " %s@%s", |
| 306 |
0 |
| profile[(seq->profile_level_id >> 4) - 1], |
| 307 |
0 |
| level[((seq->profile_level_id & 15) - 4) >> 1]); |
| 308 |
0 |
▶ | else if (0x82 <= seq->profile_level_id && |
Branch: 1 branch
| Branch | True | False | Total |
| else if (0x82 <= seq->profile_level_id && |
0 |
0 |
0 |
|
| 309 |
0 |
▶ | seq->profile_level_id<= 0x8e && |
Branch: 1 branch
| Branch | True | False | Total |
| seq->profile_level_id<= 0x8e && |
0 |
0 |
0 |
|
| 310 |
0 |
▶ | profile2[seq->profile_level_id - 0x82]) |
Branch: 1 branch
| Branch | True | False | Total |
| profile2[seq->profile_level_id - 0x82]) |
0 |
0 |
0 |
|
| 311 |
0 |
| fprintf (f, " %s", profile2[seq->profile_level_id - 0x82]); |
| 312 |
0 |
▶ | else if (seq->flags & SEQ_FLAG_MPEG2) |
Branch: 1 branch
| Branch | True | False | Total |
| else if (seq->flags & SEQ_FLAG_MPEG2) |
0 |
0 |
0 |
|
| 313 |
0 |
| fprintf (f, " profile %02x", seq->profile_level_id); |
| 314 |
0 |
▶ | if (seq->flags & SEQ_FLAG_CONSTRAINED_PARAMETERS) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->flags & SEQ_FLAG_CONSTRAINED_PARAMETERS) |
0 |
0 |
0 |
|
| 315 |
0 |
| fprintf (f, " CONST"); |
| 316 |
0 |
▶ | if (seq->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) |
0 |
0 |
0 |
|
| 317 |
0 |
| fprintf (f, " PROG"); |
| 318 |
0 |
▶ | if (seq->flags & SEQ_FLAG_LOW_DELAY) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->flags & SEQ_FLAG_LOW_DELAY) |
0 |
0 |
0 |
|
| 319 |
0 |
| fprintf (f, " LOWDELAY"); |
| 320 |
0 |
▶ | if ((seq->flags & SEQ_MASK_VIDEO_FORMAT) < |
Branch: 1 branch
| Branch | True | False | Total |
| if ((seq->flags & SEQ_MASK_VIDEO_FORMAT) < |
0 |
0 |
0 |
|
| 321 |
|
| SEQ_VIDEO_FORMAT_UNSPECIFIED) |
| 322 |
0 |
| fprintf (f, " %s", video_fmt[(seq->flags & SEQ_MASK_VIDEO_FORMAT) / |
| 323 |
|
| SEQ_VIDEO_FORMAT_PAL]); |
| 324 |
0 |
▶ | if (seq->flags & SEQ_FLAG_COLOUR_DESCRIPTION) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->flags & SEQ_FLAG_COLOUR_DESCRIPTION) { |
0 |
0 |
0 |
|
| 325 |
0 |
▶ | if (seq->colour_primaries == seq->transfer_characteristics && |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->colour_primaries == seq->transfer_characteristics && |
0 |
0 |
0 |
|
| 326 |
0 |
▶ | seq->colour_primaries == seq->matrix_coefficients && |
Branch: 1 branch
| Branch | True | False | Total |
| seq->colour_primaries == seq->matrix_coefficients && |
0 |
0 |
0 |
|
| 327 |
0 |
▶ | seq->colour_primaries <= 7 && colour3[seq->colour_primaries]) |
Branch: 2 branches
| Branch | True | False | Total |
| seq->colour_primaries <= 7 && colour3[seq->colour_primaries]) |
0 |
0 |
0 |
| seq->colour_primaries <= 7 && colour3[seq->colour_primaries]) |
0 |
0 |
0 |
|
| 328 |
0 |
| fprintf (f, " %s", colour3[seq->colour_primaries]); |
| 329 |
|
| else { |
| 330 |
|
| char prim[16], trans[16], matrix[16]; |
| 331 |
0 |
| sprintf (prim, "%d", seq->colour_primaries); |
| 332 |
0 |
| sprintf (trans, "%d", seq->transfer_characteristics); |
| 333 |
0 |
| sprintf (matrix, "%d", seq->matrix_coefficients); |
| 334 |
0 |
▶ | if (seq->colour_primaries <= 7 && |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->colour_primaries <= 7 && |
0 |
0 |
0 |
|
| 335 |
0 |
▶ | colour[seq->colour_primaries]) |
Branch: 1 branch
| Branch | True | False | Total |
| colour[seq->colour_primaries]) |
0 |
0 |
0 |
|
| 336 |
0 |
| strncpy (prim, colour[seq->colour_primaries], 15); |
| 337 |
0 |
▶ | if (seq->transfer_characteristics <= 8 && |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->transfer_characteristics <= 8 && |
0 |
0 |
0 |
|
| 338 |
0 |
▶ | colour[seq->transfer_characteristics]) |
Branch: 1 branch
| Branch | True | False | Total |
| colour[seq->transfer_characteristics]) |
0 |
0 |
0 |
|
| 339 |
0 |
| strncpy (trans, colour[seq->transfer_characteristics], 15); |
| 340 |
0 |
▶ | if (seq->matrix_coefficients == 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->matrix_coefficients == 4) |
0 |
0 |
0 |
|
| 341 |
0 |
| strncpy (matrix, "FCC", 15); |
| 342 |
0 |
▶ | else if (seq->matrix_coefficients <= 7 && |
Branch: 1 branch
| Branch | True | False | Total |
| else if (seq->matrix_coefficients <= 7 && |
0 |
0 |
0 |
|
| 343 |
0 |
▶ | colour[seq->matrix_coefficients]) |
Branch: 1 branch
| Branch | True | False | Total |
| colour[seq->matrix_coefficients]) |
0 |
0 |
0 |
|
| 344 |
0 |
| strncpy (matrix, colour[seq->matrix_coefficients], 15); |
| 345 |
0 |
| fprintf (f, " COLORS (prim %s trans %s matrix %s)", |
| 346 |
|
| prim, trans, matrix); |
| 347 |
|
| } |
| 348 |
|
| } |
| 349 |
0 |
| fprintf (f, " %dx%d chroma %dx%d fps %.*f maxBps %d vbv %d " |
| 350 |
|
| "picture %dx%d display %dx%d pixel %dx%d", |
| 351 |
0 |
| seq->width, seq->height, |
| 352 |
0 |
| seq->chroma_width, seq->chroma_height, |
| 353 |
0 |
| 27000000%seq->frame_period?2:0, 27000000.0/seq->frame_period, |
| 354 |
0 |
| seq->byte_rate, seq->vbv_buffer_size, |
| 355 |
0 |
| seq->picture_width, seq->picture_height, |
| 356 |
0 |
| seq->display_width, seq->display_height, |
| 357 |
0 |
▶ | seq->pixel_width, seq->pixel_height); |
Branch: 1 branch
| Branch | True | False | Total |
| seq->pixel_width, seq->pixel_height); |
0 |
0 |
0 |
|
| 358 |
0 |
▶ | if (mpeg2_guess_aspect (seq, &pixel_width, &pixel_height)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (mpeg2_guess_aspect (seq, &pixel_width, &pixel_height)) |
0 |
0 |
0 |
|
| 359 |
0 |
| fprintf (f, " guessed %dx%d", pixel_width, pixel_height); |
| 360 |
0 |
| fprintf (f, "\n"); |
| 361 |
0 |
| break; |
| 362 |
0 |
| case STATE_GOP: |
| 363 |
0 |
▶ | if (gop->flags & GOP_FLAG_DROP_FRAME) |
Branch: 1 branch
| Branch | True | False | Total |
| if (gop->flags & GOP_FLAG_DROP_FRAME) |
0 |
0 |
0 |
|
| 364 |
0 |
| fprintf (f, " DROP"); |
| 365 |
0 |
▶ | if (gop->flags & GOP_FLAG_CLOSED_GOP) |
Branch: 1 branch
| Branch | True | False | Total |
| if (gop->flags & GOP_FLAG_CLOSED_GOP) |
0 |
0 |
0 |
|
| 366 |
0 |
| fprintf (f, " CLOSED"); |
| 367 |
0 |
▶ | if (gop->flags & GOP_FLAG_BROKEN_LINK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (gop->flags & GOP_FLAG_BROKEN_LINK) |
0 |
0 |
0 |
|
| 368 |
0 |
| fprintf (f, " BROKEN"); |
| 369 |
0 |
| fprintf (f, " %2d:%2d:%2d:%2d\n", |
| 370 |
0 |
| gop->hours, gop->minutes, gop->seconds, gop->pictures); |
| 371 |
0 |
| break; |
| 372 |
0 |
| case STATE_PICTURE: |
| 373 |
|
| case STATE_PICTURE_2ND: |
| 374 |
0 |
| pic = ((state == STATE_PICTURE) ? |
| 375 |
0 |
▶ | info->current_picture : info->current_picture_2nd); |
Branch: 1 branch
| Branch | True | False | Total |
| info->current_picture : info->current_picture_2nd); |
0 |
0 |
0 |
|
| 376 |
0 |
| fprintf (f, " %c", |
| 377 |
0 |
| coding_type[pic->flags & PIC_MASK_CODING_TYPE]); |
| 378 |
0 |
▶ | if (pic->flags & PIC_FLAG_PROGRESSIVE_FRAME) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic->flags & PIC_FLAG_PROGRESSIVE_FRAME) |
0 |
0 |
0 |
|
| 379 |
0 |
| fprintf (f, " PROG"); |
| 380 |
0 |
▶ | if (pic->flags & PIC_FLAG_SKIP) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic->flags & PIC_FLAG_SKIP) |
0 |
0 |
0 |
|
| 381 |
0 |
| fprintf (f, " SKIP"); |
| 382 |
0 |
| fprintf (f, " fields %d", pic->nb_fields); |
| 383 |
0 |
▶ | if (pic->flags & PIC_FLAG_TOP_FIELD_FIRST) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic->flags & PIC_FLAG_TOP_FIELD_FIRST) |
0 |
0 |
0 |
|
| 384 |
0 |
| fprintf (f, " TFF"); |
| 385 |
0 |
▶ | if (pic->flags & PIC_FLAG_TAGS) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic->flags & PIC_FLAG_TAGS) |
0 |
0 |
0 |
|
| 386 |
0 |
| fprintf (f, " pts %08x dts %08x", pic->tag, pic->tag2); |
| 387 |
0 |
| fprintf (f, " time_ref %d", pic->temporal_reference); |
| 388 |
0 |
▶ | if (pic->flags & PIC_FLAG_COMPOSITE_DISPLAY) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pic->flags & PIC_FLAG_COMPOSITE_DISPLAY) |
0 |
0 |
0 |
|
| 389 |
0 |
| fprintf (f, " composite %05x", pic->flags >> 12); |
| 390 |
0 |
| fprintf (f, " offset"); |
| 391 |
0 |
| nb_pos = pic->nb_fields; |
| 392 |
0 |
▶ | if (seq->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) |
Branch: 1 branch
| Branch | True | False | Total |
| if (seq->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) |
0 |
0 |
0 |
|
| 393 |
0 |
| nb_pos >>= 1; |
| 394 |
0 |
▶ | for (i = 0; i < nb_pos; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nb_pos; i++) |
0 |
0 |
0 |
|
| 395 |
0 |
| fprintf (f, " %d/%d", |
| 396 |
0 |
| pic->display_offset[i].x, pic->display_offset[i].y); |
| 397 |
0 |
| fprintf (f, "\n"); |
| 398 |
0 |
| break; |
| 399 |
0 |
| default: |
| 400 |
0 |
| fprintf (f, "\n"); |
| 401 |
|
| } |
| 402 |
0 |
▶ | if (verbose > 2 && info->user_data_len) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (verbose > 2 && info->user_data_len) { |
0 |
0 |
0 |
| if (verbose > 2 && info->user_data_len) { |
0 |
0 |
0 |
|
| 403 |
0 |
| fprintf (f, " USER_DATA %d bytes\n", info->user_data_len); |
| 404 |
0 |
▶ | if (verbose > 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (verbose > 3) |
0 |
0 |
0 |
|
| 405 |
0 |
▶ | for (i = 0; i < info->user_data_len; i += 16) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < info->user_data_len; i += 16) { |
0 |
0 |
0 |
|
| 406 |
|
| unsigned int j; |
| 407 |
|
| |
| 408 |
0 |
| fprintf (f, " "); |
| 409 |
0 |
▶ | for (j = i; j < i + 16; j++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = i; j < i + 16; j++) |
0 |
0 |
0 |
|
| 410 |
0 |
▶ | if (j < info->user_data_len) |
Branch: 1 branch
| Branch | True | False | Total |
| if (j < info->user_data_len) |
0 |
0 |
0 |
|
| 411 |
0 |
| fprintf (f, "%02x ", info->user_data[j]); |
| 412 |
|
| else |
| 413 |
0 |
| fprintf (f, " "); |
| 414 |
0 |
| fprintf (f, " "); |
| 415 |
0 |
▶ | for (j = i; j < i + 16; j++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = i; j < i + 16; j++) |
0 |
0 |
0 |
|
| 416 |
0 |
▶ | if (j < info->user_data_len && |
Branch: 1 branch
| Branch | True | False | Total |
| if (j < info->user_data_len && |
0 |
0 |
0 |
|
| 417 |
0 |
▶ | 32 <= info->user_data[j] && info->user_data[j] <= 126) |
Branch: 2 branches
| Branch | True | False | Total |
| 32 <= info->user_data[j] && info->user_data[j] <= 126) |
0 |
0 |
0 |
| 32 <= info->user_data[j] && info->user_data[j] <= 126) |
0 |
0 |
0 |
|
| 418 |
0 |
| fprintf (f, "%c", info->user_data[j]); |
| 419 |
|
| else |
| 420 |
0 |
| fprintf (f, " "); |
| 421 |
0 |
| fprintf (f, "\n"); |
| 422 |
|
| } |
| 423 |
|
| } |
| 424 |
0 |
▶ | if (state == STATE_END || state == STATE_INVALID_END) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (state == STATE_END || state == STATE_INVALID_END) { |
0 |
0 |
0 |
| if (state == STATE_END || state == STATE_INVALID_END) { |
0 |
0 |
0 |
|
| 425 |
0 |
| sequence_save (NULL); |
| 426 |
0 |
| gop_save (NULL); |
| 427 |
0 |
| fbuf_save (NULL, &last_curbuf); |
| 428 |
0 |
| fbuf_save (NULL, &last_dispbuf); |
| 429 |
0 |
| fbuf_save (NULL, &last_discbuf); |
| 430 |
0 |
| picture_save (NULL, &last_curpic); |
| 431 |
0 |
| picture_save (NULL, &last_curpic2); |
| 432 |
0 |
| picture_save (NULL, &last_disppic); |
| 433 |
0 |
| picture_save (NULL, &last_disppic2); |
| 434 |
|
| } else { |
| 435 |
0 |
| sequence_save (seq); |
| 436 |
0 |
| gop_save (gop); |
| 437 |
0 |
| fbuf_save (info->current_fbuf, &last_curbuf); |
| 438 |
0 |
| fbuf_save (info->display_fbuf, &last_dispbuf); |
| 439 |
0 |
| fbuf_save (info->discard_fbuf, &last_discbuf); |
| 440 |
0 |
| picture_save (info->current_picture, &last_curpic); |
| 441 |
0 |
| picture_save (info->current_picture_2nd, &last_curpic2); |
| 442 |
0 |
| picture_save (info->display_picture, &last_disppic); |
| 443 |
0 |
| picture_save (info->display_picture_2nd, &last_disppic2); |
| 444 |
|
| } |
| 445 |
|
| } |