comparison swf.c @ 806:e1007d19f28d libavformat

tell the user if compressed swf found
author alex
date Sat, 02 Jul 2005 21:59:33 +0000
parents c5077fdab490
children 2b09fa58db70
comparison
equal deleted inserted replaced
805:6ace9fde011e 806:e1007d19f28d
711 len = tag & 0x3f; 711 len = tag & 0x3f;
712 tag = tag >> 6; 712 tag = tag >> 6;
713 if (len == 0x3f) { 713 if (len == 0x3f) {
714 len = get_le32(pb); 714 len = get_le32(pb);
715 } 715 }
716 // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
716 *len_ptr = len; 717 *len_ptr = len;
717 return tag; 718 return tag;
718 } 719 }
719 720
720 721
721 static int swf_probe(AVProbeData *p) 722 static int swf_probe(AVProbeData *p)
722 { 723 {
723 /* check file header */ 724 /* check file header */
724 if (p->buf_size <= 16) 725 if (p->buf_size <= 16)
725 return 0; 726 return 0;
726 if (p->buf[0] == 'F' && p->buf[1] == 'W' && 727 if ((p->buf[0] == 'F' || p->buf[0] == 'C') && p->buf[1] == 'W' &&
727 p->buf[2] == 'S') 728 p->buf[2] == 'S')
728 return AVPROBE_SCORE_MAX; 729 return AVPROBE_SCORE_MAX;
729 else 730 else
730 return 0; 731 return 0;
731 } 732 }
742 swf = av_malloc(sizeof(SWFContext)); 743 swf = av_malloc(sizeof(SWFContext));
743 if (!swf) 744 if (!swf)
744 return -1; 745 return -1;
745 s->priv_data = swf; 746 s->priv_data = swf;
746 747
747 if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0)) 748 tag = get_be32(pb) & 0xffffff00;
749
750 if (tag == MKBETAG('C', 'W', 'S', 0))
751 {
752 av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
753 return AVERROR_IO;
754 }
755 if (tag != MKBETAG('F', 'W', 'S', 0))
748 return AVERROR_IO; 756 return AVERROR_IO;
749 get_le32(pb); 757 get_le32(pb);
750 /* skip rectangle size */ 758 /* skip rectangle size */
751 nbits = get_byte(pb) >> 3; 759 nbits = get_byte(pb) >> 3;
752 len = (4 * nbits - 3 + 7) / 8; 760 len = (4 * nbits - 3 + 7) / 8;