comparison matroskadec.c @ 3690:50c074bc02b4 libavformat

matroskadec: expand useless ebml_read_element_id() wrapper
author aurel
date Tue, 05 Aug 2008 00:42:58 +0000
parents bce0dc931087
children b91cad3c97e8
comparison
equal deleted inserted replaced
3689:bce0dc931087 3690:50c074bc02b4
520 520
521 return read; 521 return read;
522 } 522 }
523 523
524 /* 524 /*
525 * Read: the element content data ID.
526 * 0 is success, < 0 is failure.
527 */
528 static int ebml_read_element_id(MatroskaDemuxContext *matroska, uint32_t *id)
529 {
530 int read;
531 uint64_t total;
532
533 /* read out the "EBML number", include tag in ID */
534 if ((read = ebml_read_num(matroska, matroska->ctx->pb, 4, &total)) < 0)
535 return read;
536 *id = total | (1 << (read * 7));
537
538 return 0;
539 }
540
541 /*
542 * Read the next element as an unsigned int. 525 * Read the next element as an unsigned int.
543 * 0 is success, < 0 is failure. 526 * 0 is success, < 0 is failure.
544 */ 527 */
545 static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) 528 static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
546 { 529 {
681 } 664 }
682 665
683 static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, 666 static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
684 void *data) 667 void *data)
685 { 668 {
686 uint32_t id; 669 uint64_t id;
687 int res = ebml_read_element_id(matroska, &id); 670 int res = ebml_read_num(matroska, matroska->ctx->pb, 4, &id);
671 id |= 1 << 7*res;
688 return res < 0 ? res : ebml_parse_id(matroska, syntax, id, data); 672 return res < 0 ? res : ebml_parse_id(matroska, syntax, id, data);
689 } 673 }
690 674
691 static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, 675 static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
692 void *data) 676 void *data)