| | 192 | INFO ("+ Attempting to set vendor string"); |
|---|
| | 193 | err = oggz_comment_set_vendor (oggz, serialno, vendor_flac ); |
|---|
| | 194 | if (err) FAIL ("Operation failed"); |
|---|
| | 195 | |
|---|
| | 196 | INFO ("+ Retrieving vendor string"); |
|---|
| | 197 | vendor = oggz_comment_get_vendor (oggz, serialno); |
|---|
| | 198 | if (!vendor || strcmp(vendor, vendor_flac)) |
|---|
| | 199 | FAIL ("+ Operation failed"); |
|---|
| | 200 | |
|---|
| | 201 | INFO("+ Generating FLAC comment packet"); |
|---|
| | 202 | op = oggz_comment_generate (oggz, serialno, OGGZ_CONTENT_FLAC, 0); |
|---|
| | 203 | if (!op) FAIL ("Operation failed"); |
|---|
| | 204 | |
|---|
| | 205 | INFO("+ Checking FLAC comment packet"); |
|---|
| | 206 | if (op->bytes != sizeof comment_packet_flac || |
|---|
| | 207 | memcmp (op->packet, comment_packet_flac, op->bytes) ) |
|---|
| | 208 | FAIL ("Incorrect packet"); |
|---|
| | 209 | oggz_packet_destroy(op); |
|---|
| | 210 | |
|---|
| | 211 | |
|---|
| | 212 | INFO("+ Generating OggPCM comment packet"); |
|---|
| | 213 | /* OggPCM and Speex comment packets are identical. */ |
|---|
| | 214 | err = oggz_comment_set_vendor (oggz, serialno, vendor_speex ); |
|---|
| | 215 | op = oggz_comment_generate (oggz, serialno, OGGZ_CONTENT_PCM, 0); |
|---|
| | 216 | if (err || !op) FAIL ("Operation failed"); |
|---|
| | 217 | |
|---|
| | 218 | INFO("+ Checking OggPCM comment packet"); |
|---|
| | 219 | if (op->bytes != sizeof comment_packet_speex || |
|---|
| | 220 | memcmp (op->packet, comment_packet_speex, op->bytes) ) |
|---|
| | 221 | FAIL ("Incorrect packet"); |
|---|
| | 222 | oggz_packet_destroy(op); |
|---|
| | 223 | |
|---|
| | 224 | |
|---|
| | 225 | INFO("+ Generating Speex comment packet"); |
|---|
| | 226 | err = oggz_comment_set_vendor (oggz, serialno, vendor_speex ); |
|---|
| | 227 | op = oggz_comment_generate (oggz, serialno, OGGZ_CONTENT_SPEEX, 0); |
|---|
| | 228 | if (err || !op) FAIL ("Operation failed"); |
|---|
| | 229 | |
|---|
| | 230 | INFO("+ Checking Speex comment packet"); |
|---|
| | 231 | if (op->bytes != sizeof comment_packet_speex || |
|---|
| | 232 | memcmp (op->packet, comment_packet_speex, op->bytes) ) |
|---|
| | 233 | FAIL ("Incorrect packet"); |
|---|
| | 234 | oggz_packet_destroy(op); |
|---|
| | 235 | |
|---|
| | 236 | |
|---|
| | 237 | INFO("+ Generating Theora comment packet"); |
|---|
| | 238 | err = oggz_comment_set_vendor (oggz, serialno, vendor_theora ); |
|---|
| | 239 | op = oggz_comment_generate (oggz, serialno, OGGZ_CONTENT_THEORA, 0); |
|---|
| | 240 | if (err || !op) FAIL ("Operation failed"); |
|---|
| | 241 | |
|---|
| | 242 | INFO("+ Checking Theora comment packet"); |
|---|
| | 243 | if (op->bytes != sizeof comment_packet_theora || |
|---|
| | 244 | memcmp (op->packet, comment_packet_theora, op->bytes) ) |
|---|
| | 245 | FAIL ("Incorrect packet"); |
|---|
| | 246 | oggz_packet_destroy(op); |
|---|
| | 247 | |
|---|
| | 248 | |
|---|
| | 249 | INFO("+ Generating Vorbis comment packet"); |
|---|
| | 250 | err = oggz_comment_set_vendor (oggz, serialno, vendor_vorbis ); |
|---|
| | 251 | op = oggz_comment_generate (oggz, serialno, OGGZ_CONTENT_VORBIS, 0); |
|---|
| | 252 | if (err || !op) FAIL ("Operation failed"); |
|---|
| | 253 | |
|---|
| | 254 | INFO("+ Checking Vorbis comment packet"); |
|---|
| | 255 | if (op->bytes != sizeof comment_packet_vorbis || |
|---|
| | 256 | memcmp (op->packet, comment_packet_vorbis, op->bytes) ) |
|---|
| | 257 | FAIL ("Incorrect packet"); |
|---|
| | 258 | oggz_packet_destroy(op); |
|---|
| | 259 | |
|---|
| | 260 | INFO("+ Testing comment generate for unsupported type"); |
|---|
| | 261 | op = oggz_comment_generate (oggz, serialno, OGGZ_CONTENT_UNKNOWN, 0); |
|---|
| | 262 | if(op) FAIL ("Returned comment packet for unsupported type"); |
|---|
| | 263 | oggz_packet_destroy(op); |
|---|
| | 264 | |
|---|
| | 265 | INFO("+ Testing comment generate for invalid serialno"); |
|---|
| | 266 | op = oggz_comment_generate (oggz, invalidserialno, OGGZ_CONTENT_VORBIS, 0); |
|---|
| | 267 | if(op) FAIL ("Returned comment packet for invalid serialno"); |
|---|
| | 268 | oggz_packet_destroy(op); |
|---|
| | 269 | |
|---|
| | 270 | |
|---|