comparison matroskadec.c @ 2274:b21c2af60bc9 libavformat

Replace all occurrences of AVERROR_IO with AVERROR(EIO).
author takis
date Thu, 19 Jul 2007 15:23:32 +0000
parents 7eb456c4ed8a
children 3c1e2d519277
comparison
equal deleted inserted replaced
2273:7eb456c4ed8a 2274:b21c2af60bc9
221 offset_t pos = url_ftell(pb); 221 offset_t pos = url_ftell(pb);
222 av_log(matroska->ctx, AV_LOG_ERROR, 222 av_log(matroska->ctx, AV_LOG_ERROR,
223 "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", 223 "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
224 pos, pos); 224 pos, pos);
225 } 225 }
226 return AVERROR_IO; /* EOS or actual I/O error */ 226 return AVERROR(EIO); /* EOS or actual I/O error */
227 } 227 }
228 228
229 /* get the length of the EBML number */ 229 /* get the length of the EBML number */
230 while (read <= max_size && !(total & len_mask)) { 230 while (read <= max_size && !(total & len_mask)) {
231 read++; 231 read++;
489 } 489 }
490 if (get_buffer(pb, (uint8_t *) *str, size) != size) { 490 if (get_buffer(pb, (uint8_t *) *str, size) != size) {
491 offset_t pos = url_ftell(pb); 491 offset_t pos = url_ftell(pb);
492 av_log(matroska->ctx, AV_LOG_ERROR, 492 av_log(matroska->ctx, AV_LOG_ERROR,
493 "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos); 493 "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos);
494 return AVERROR_IO; 494 return AVERROR(EIO);
495 } 495 }
496 (*str)[size] = '\0'; 496 (*str)[size] = '\0';
497 497
498 return 0; 498 return 0;
499 } 499 }
586 586
587 if (get_buffer(pb, *binary, *size) != *size) { 587 if (get_buffer(pb, *binary, *size) != *size) {
588 offset_t pos = url_ftell(pb); 588 offset_t pos = url_ftell(pb);
589 av_log(matroska->ctx, AV_LOG_ERROR, 589 av_log(matroska->ctx, AV_LOG_ERROR,
590 "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos); 590 "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos);
591 return AVERROR_IO; 591 return AVERROR(EIO);
592 } 592 }
593 593
594 return 0; 594 return 0;
595 } 595 }
596 596
691 if ((res = ebml_read_master(matroska, &id)) < 0) 691 if ((res = ebml_read_master(matroska, &id)) < 0)
692 return res; 692 return res;
693 693
694 while (res == 0) { 694 while (res == 0) {
695 if (!(id = ebml_peek_id(matroska, &level_up))) 695 if (!(id = ebml_peek_id(matroska, &level_up)))
696 return AVERROR_IO; 696 return AVERROR(EIO);
697 697
698 /* end-of-header */ 698 /* end-of-header */
699 if (level_up) 699 if (level_up)
700 break; 700 break;
701 701
901 901
902 av_log(matroska->ctx, AV_LOG_DEBUG, "Parsing info...\n"); 902 av_log(matroska->ctx, AV_LOG_DEBUG, "Parsing info...\n");
903 903
904 while (res == 0) { 904 while (res == 0) {
905 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 905 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
906 res = AVERROR_IO; 906 res = AVERROR(EIO);
907 break; 907 break;
908 } else if (matroska->level_up) { 908 } else if (matroska->level_up) {
909 matroska->level_up--; 909 matroska->level_up--;
910 break; 910 break;
911 } 911 }
1000 return res; 1000 return res;
1001 1001
1002 /* try reading the trackentry headers */ 1002 /* try reading the trackentry headers */
1003 while (res == 0) { 1003 while (res == 0) {
1004 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1004 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1005 res = AVERROR_IO; 1005 res = AVERROR(EIO);
1006 break; 1006 break;
1007 } else if (matroska->level_up > 0) { 1007 } else if (matroska->level_up > 0) {
1008 matroska->level_up--; 1008 matroska->level_up--;
1009 break; 1009 break;
1010 } 1010 }
1073 break; 1073 break;
1074 videotrack = (MatroskaVideoTrack *)track; 1074 videotrack = (MatroskaVideoTrack *)track;
1075 1075
1076 while (res == 0) { 1076 while (res == 0) {
1077 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1077 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1078 res = AVERROR_IO; 1078 res = AVERROR(EIO);
1079 break; 1079 break;
1080 } else if (matroska->level_up > 0) { 1080 } else if (matroska->level_up > 0) {
1081 matroska->level_up--; 1081 matroska->level_up--;
1082 break; 1082 break;
1083 } 1083 }
1244 audiotrack->channels = 1; 1244 audiotrack->channels = 1;
1245 audiotrack->samplerate = 8000; 1245 audiotrack->samplerate = 8000;
1246 1246
1247 while (res == 0) { 1247 while (res == 0) {
1248 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1248 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1249 res = AVERROR_IO; 1249 res = AVERROR(EIO);
1250 break; 1250 break;
1251 } else if (matroska->level_up > 0) { 1251 } else if (matroska->level_up > 0) {
1252 matroska->level_up--; 1252 matroska->level_up--;
1253 break; 1253 break;
1254 } 1254 }
1442 1442
1443 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing tracks...\n"); 1443 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing tracks...\n");
1444 1444
1445 while (res == 0) { 1445 while (res == 0) {
1446 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1446 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1447 res = AVERROR_IO; 1447 res = AVERROR(EIO);
1448 break; 1448 break;
1449 } else if (matroska->level_up) { 1449 } else if (matroska->level_up) {
1450 matroska->level_up--; 1450 matroska->level_up--;
1451 break; 1451 break;
1452 } 1452 }
1485 1485
1486 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing index...\n"); 1486 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing index...\n");
1487 1487
1488 while (res == 0) { 1488 while (res == 0) {
1489 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1489 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1490 res = AVERROR_IO; 1490 res = AVERROR(EIO);
1491 break; 1491 break;
1492 } else if (matroska->level_up) { 1492 } else if (matroska->level_up) {
1493 matroska->level_up--; 1493 matroska->level_up--;
1494 break; 1494 break;
1495 } 1495 }
1506 idx.time = (uint64_t) -1; 1506 idx.time = (uint64_t) -1;
1507 idx.track = (uint16_t) -1; 1507 idx.track = (uint16_t) -1;
1508 1508
1509 while (res == 0) { 1509 while (res == 0) {
1510 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1510 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1511 res = AVERROR_IO; 1511 res = AVERROR(EIO);
1512 break; 1512 break;
1513 } else if (matroska->level_up) { 1513 } else if (matroska->level_up) {
1514 matroska->level_up--; 1514 matroska->level_up--;
1515 break; 1515 break;
1516 } 1516 }
1533 break; 1533 break;
1534 1534
1535 while (res == 0) { 1535 while (res == 0) {
1536 if (!(id = ebml_peek_id (matroska, 1536 if (!(id = ebml_peek_id (matroska,
1537 &matroska->level_up))) { 1537 &matroska->level_up))) {
1538 res = AVERROR_IO; 1538 res = AVERROR(EIO);
1539 break; 1539 break;
1540 } else if (matroska->level_up) { 1540 } else if (matroska->level_up) {
1541 matroska->level_up--; 1541 matroska->level_up--;
1542 break; 1542 break;
1543 } 1543 }
1640 int res = 0; 1640 int res = 0;
1641 uint32_t id; 1641 uint32_t id;
1642 1642
1643 while (res == 0) { 1643 while (res == 0) {
1644 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1644 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1645 res = AVERROR_IO; 1645 res = AVERROR(EIO);
1646 break; 1646 break;
1647 } else if (matroska->level_up) { 1647 } else if (matroska->level_up) {
1648 matroska->level_up--; 1648 matroska->level_up--;
1649 break; 1649 break;
1650 } 1650 }
1678 1678
1679 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing seekhead...\n"); 1679 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing seekhead...\n");
1680 1680
1681 while (res == 0) { 1681 while (res == 0) {
1682 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1682 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1683 res = AVERROR_IO; 1683 res = AVERROR(EIO);
1684 break; 1684 break;
1685 } else if (matroska->level_up) { 1685 } else if (matroska->level_up) {
1686 matroska->level_up--; 1686 matroska->level_up--;
1687 break; 1687 break;
1688 } 1688 }
1695 if ((res = ebml_read_master(matroska, &id)) < 0) 1695 if ((res = ebml_read_master(matroska, &id)) < 0)
1696 break; 1696 break;
1697 1697
1698 while (res == 0) { 1698 while (res == 0) {
1699 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1699 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1700 res = AVERROR_IO; 1700 res = AVERROR(EIO);
1701 break; 1701 break;
1702 } else if (matroska->level_up) { 1702 } else if (matroska->level_up) {
1703 matroska->level_up--; 1703 matroska->level_up--;
1704 break; 1704 break;
1705 } 1705 }
1911 } 1911 }
1912 1912
1913 /* The next thing is a segment. */ 1913 /* The next thing is a segment. */
1914 while (1) { 1914 while (1) {
1915 if (!(id = ebml_peek_id(matroska, &last_level))) 1915 if (!(id = ebml_peek_id(matroska, &last_level)))
1916 return AVERROR_IO; 1916 return AVERROR(EIO);
1917 if (id == MATROSKA_ID_SEGMENT) 1917 if (id == MATROSKA_ID_SEGMENT)
1918 break; 1918 break;
1919 1919
1920 /* oi! */ 1920 /* oi! */
1921 av_log(matroska->ctx, AV_LOG_INFO, 1921 av_log(matroska->ctx, AV_LOG_INFO,
1934 1934
1935 matroska->time_scale = 1000000; 1935 matroska->time_scale = 1000000;
1936 /* we've found our segment, start reading the different contents in here */ 1936 /* we've found our segment, start reading the different contents in here */
1937 while (res == 0) { 1937 while (res == 0) {
1938 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 1938 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1939 res = AVERROR_IO; 1939 res = AVERROR(EIO);
1940 break; 1940 break;
1941 } else if (matroska->level_up) { 1941 } else if (matroska->level_up) {
1942 matroska->level_up--; 1942 matroska->level_up--;
1943 break; 1943 break;
1944 } 1944 }
2495 2495
2496 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing blockgroup...\n"); 2496 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing blockgroup...\n");
2497 2497
2498 while (res == 0) { 2498 while (res == 0) {
2499 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 2499 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
2500 res = AVERROR_IO; 2500 res = AVERROR(EIO);
2501 break; 2501 break;
2502 } else if (matroska->level_up) { 2502 } else if (matroska->level_up) {
2503 matroska->level_up--; 2503 matroska->level_up--;
2504 break; 2504 break;
2505 } 2505 }
2573 av_log(matroska->ctx, AV_LOG_DEBUG, 2573 av_log(matroska->ctx, AV_LOG_DEBUG,
2574 "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb)); 2574 "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb));
2575 2575
2576 while (res == 0) { 2576 while (res == 0) {
2577 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 2577 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
2578 res = AVERROR_IO; 2578 res = AVERROR(EIO);
2579 break; 2579 break;
2580 } else if (matroska->level_up) { 2580 } else if (matroska->level_up) {
2581 matroska->level_up--; 2581 matroska->level_up--;
2582 break; 2582 break;
2583 } 2583 }
2638 /* Read stream until we have a packet queued. */ 2638 /* Read stream until we have a packet queued. */
2639 while (matroska_deliver_packet(matroska, pkt)) { 2639 while (matroska_deliver_packet(matroska, pkt)) {
2640 2640
2641 /* Have we already reached the end? */ 2641 /* Have we already reached the end? */
2642 if (matroska->done) 2642 if (matroska->done)
2643 return AVERROR_IO; 2643 return AVERROR(EIO);
2644 2644
2645 res = 0; 2645 res = 0;
2646 while (res == 0) { 2646 while (res == 0) {
2647 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { 2647 if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
2648 return AVERROR_IO; 2648 return AVERROR(EIO);
2649 } else if (matroska->level_up) { 2649 } else if (matroska->level_up) {
2650 matroska->level_up--; 2650 matroska->level_up--;
2651 break; 2651 break;
2652 } 2652 }
2653 2653