comparison iff.c @ 5660:1701ad9b6064 libavformat

Support IFF ANNO (annotation) chunk type
author pross
date Tue, 16 Feb 2010 09:55:56 +0000
parents b3d4ef7e53ad
children fd3b7b9b63a8
comparison
equal deleted inserted replaced
5659:d76ffa7128d4 5660:1701ad9b6064
49 #define ID_CSET MKTAG('C','S','E','T') 49 #define ID_CSET MKTAG('C','S','E','T')
50 #define ID_FVER MKTAG('F','V','E','R') 50 #define ID_FVER MKTAG('F','V','E','R')
51 #define ID_NAME MKTAG('N','A','M','E') 51 #define ID_NAME MKTAG('N','A','M','E')
52 #define ID_TEXT MKTAG('T','E','X','T') 52 #define ID_TEXT MKTAG('T','E','X','T')
53 #define ID_BODY MKTAG('B','O','D','Y') 53 #define ID_BODY MKTAG('B','O','D','Y')
54 #define ID_ANNO MKTAG('A','N','N','O')
54 55
55 #define LEFT 2 56 #define LEFT 2
56 #define RIGHT 4 57 #define RIGHT 4
57 #define STEREO 6 58 #define STEREO 6
58 59
97 ByteIOContext *pb = s->pb; 98 ByteIOContext *pb = s->pb;
98 AVStream *st; 99 AVStream *st;
99 uint32_t chunk_id, data_size; 100 uint32_t chunk_id, data_size;
100 int padding, done = 0; 101 int padding, done = 0;
101 int compression = -1; 102 int compression = -1;
103 char *buf;
102 104
103 st = av_new_stream(s, 0); 105 st = av_new_stream(s, 0);
104 if (!st) 106 if (!st)
105 return AVERROR(ENOMEM); 107 return AVERROR(ENOMEM);
106 108
154 st->sample_aspect_ratio.num = get_byte(pb); 156 st->sample_aspect_ratio.num = get_byte(pb);
155 st->sample_aspect_ratio.den = get_byte(pb); 157 st->sample_aspect_ratio.den = get_byte(pb);
156 url_fskip(pb, 4); // source page width, height 158 url_fskip(pb, 4); // source page width, height
157 break; 159 break;
158 160
161 case ID_ANNO:
162 buf = av_malloc(data_size + 1);
163 if (!buf)
164 break;
165 get_buffer(pb, buf, data_size);
166 buf[data_size] = 0;
167 av_metadata_set2(&s->metadata, "comment", buf, AV_METADATA_DONT_STRDUP_VAL);
168 break;
169
159 default: 170 default:
160 url_fseek(pb, data_size + padding, SEEK_CUR); 171 url_fseek(pb, data_size + padding, SEEK_CUR);
161 break; 172 break;
162 } 173 }
163 } 174 }