comparison dvbsubdec.c @ 5931:3bb292a4ae12 libavcodec

cosmetic (place { consistently)
author michael
date Mon, 19 Nov 2007 20:30:00 +0000
parents 8a9716d0ccff
children d457f0c01ec5
comparison
equal deleted inserted replaced
5930:8a9716d0ccff 5931:3bb292a4ae12
311 static void delete_state(DVBSubContext *ctx) 311 static void delete_state(DVBSubContext *ctx)
312 { 312 {
313 DVBSubRegion *region; 313 DVBSubRegion *region;
314 DVBSubCLUT *clut; 314 DVBSubCLUT *clut;
315 315
316 while (ctx->region_list) 316 while (ctx->region_list) {
317 {
318 region = ctx->region_list; 317 region = ctx->region_list;
319 318
320 ctx->region_list = region->next; 319 ctx->region_list = region->next;
321 320
322 delete_region_display_list(ctx, region); 321 delete_region_display_list(ctx, region);
324 av_free(region->pbuf); 323 av_free(region->pbuf);
325 324
326 av_free(region); 325 av_free(region);
327 } 326 }
328 327
329 while (ctx->clut_list) 328 while (ctx->clut_list) {
330 {
331 clut = ctx->clut_list; 329 clut = ctx->clut_list;
332 330
333 ctx->clut_list = clut->next; 331 ctx->clut_list = clut->next;
334 332
335 av_free(clut); 333 av_free(clut);
418 DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data; 416 DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
419 DVBSubRegionDisplay *display; 417 DVBSubRegionDisplay *display;
420 418
421 delete_state(ctx); 419 delete_state(ctx);
422 420
423 while (ctx->display_list) 421 while (ctx->display_list) {
424 {
425 display = ctx->display_list; 422 display = ctx->display_list;
426 ctx->display_list = display->next; 423 ctx->display_list = display->next;
427 424
428 av_free(display); 425 av_free(display);
429 } 426 }
737 av_log(avctx, AV_LOG_INFO, "DVB pixel block size %d, %s field:\n", buf_size, 734 av_log(avctx, AV_LOG_INFO, "DVB pixel block size %d, %s field:\n", buf_size,
738 top_bottom ? "bottom" : "top"); 735 top_bottom ? "bottom" : "top");
739 #endif 736 #endif
740 737
741 #ifdef DEBUG_PACKET_CONTENTS 738 #ifdef DEBUG_PACKET_CONTENTS
742 for (i = 0; i < buf_size; i++) 739 for (i = 0; i < buf_size; i++) {
743 {
744 if (i % 16 == 0) 740 if (i % 16 == 0)
745 av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i); 741 av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i);
746 742
747 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); 743 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
748 if (i % 16 == 15) 744 if (i % 16 == 15)
910 #ifdef DEBUG_PACKET_CONTENTS 906 #ifdef DEBUG_PACKET_CONTENTS
911 int i; 907 int i;
912 908
913 av_log(avctx, AV_LOG_INFO, "DVB clut packet:\n"); 909 av_log(avctx, AV_LOG_INFO, "DVB clut packet:\n");
914 910
915 for (i=0; i < buf_size; i++) 911 for (i=0; i < buf_size; i++) {
916 {
917 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); 912 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
918 if (i % 16 == 15) 913 if (i % 16 == 15)
919 av_log(avctx, AV_LOG_INFO, "\n"); 914 av_log(avctx, AV_LOG_INFO, "\n");
920 } 915 }
921 916
938 933
939 clut->next = ctx->clut_list; 934 clut->next = ctx->clut_list;
940 ctx->clut_list = clut; 935 ctx->clut_list = clut;
941 } 936 }
942 937
943 while (buf + 4 < buf_end) 938 while (buf + 4 < buf_end) {
944 {
945 entry_id = *buf++; 939 entry_id = *buf++;
946 940
947 depth = (*buf) & 0xe0; 941 depth = (*buf) & 0xe0;
948 942
949 if (depth == 0) { 943 if (depth == 0) {
1004 998
1005 region_id = *buf++; 999 region_id = *buf++;
1006 1000
1007 region = get_region(ctx, region_id); 1001 region = get_region(ctx, region_id);
1008 1002
1009 if (region == NULL) 1003 if (region == NULL) {
1010 {
1011 region = av_mallocz(sizeof(DVBSubRegion)); 1004 region = av_mallocz(sizeof(DVBSubRegion));
1012 1005
1013 region->id = region_id; 1006 region->id = region_id;
1014 1007
1015 region->next = ctx->region_list; 1008 region->next = ctx->region_list;
1123 1116
1124 #ifdef DEBUG 1117 #ifdef DEBUG
1125 av_log(avctx, AV_LOG_INFO, "Page time out %ds, state %d\n", ctx->time_out, page_state); 1118 av_log(avctx, AV_LOG_INFO, "Page time out %ds, state %d\n", ctx->time_out, page_state);
1126 #endif 1119 #endif
1127 1120
1128 if (page_state == 2) 1121 if (page_state == 2) {
1129 {
1130 delete_state(ctx); 1122 delete_state(ctx);
1131 } 1123 }
1132 1124
1133 tmp_display_list = ctx->display_list; 1125 tmp_display_list = ctx->display_list;
1134 ctx->display_list = NULL; 1126 ctx->display_list = NULL;
1361 #ifdef DEBUG_PACKET_CONTENTS 1353 #ifdef DEBUG_PACKET_CONTENTS
1362 int i; 1354 int i;
1363 1355
1364 av_log(avctx, AV_LOG_INFO, "DVB sub packet:\n"); 1356 av_log(avctx, AV_LOG_INFO, "DVB sub packet:\n");
1365 1357
1366 for (i=0; i < buf_size; i++) 1358 for (i=0; i < buf_size; i++) {
1367 {
1368 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); 1359 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
1369 if (i % 16 == 15) 1360 if (i % 16 == 15)
1370 av_log(avctx, AV_LOG_INFO, "\n"); 1361 av_log(avctx, AV_LOG_INFO, "\n");
1371 } 1362 }
1372 1363
1379 return -1; 1370 return -1;
1380 1371
1381 p = buf; 1372 p = buf;
1382 p_end = buf + buf_size; 1373 p_end = buf + buf_size;
1383 1374
1384 while (p < p_end && *p == 0x0f) 1375 while (p < p_end && *p == 0x0f) {
1385 {
1386 p += 1; 1376 p += 1;
1387 segment_type = *p++; 1377 segment_type = *p++;
1388 page_id = AV_RB16(p); 1378 page_id = AV_RB16(p);
1389 p += 2; 1379 p += 2;
1390 segment_length = AV_RB16(p); 1380 segment_length = AV_RB16(p);
1417 } 1407 }
1418 1408
1419 p += segment_length; 1409 p += segment_length;
1420 } 1410 }
1421 1411
1422 if (p != p_end) 1412 if (p != p_end) {
1423 {
1424 #ifdef DEBUG 1413 #ifdef DEBUG
1425 av_log(avctx, AV_LOG_INFO, "Junk at end of packet\n"); 1414 av_log(avctx, AV_LOG_INFO, "Junk at end of packet\n");
1426 #endif 1415 #endif
1427 return -1; 1416 return -1;
1428 } 1417 }