Changeset 1191
- Timestamp:
- 2005-03-30 05:04:32 (4 years ago)
- Files:
-
- liboggz/trunk/doc/oggzdump.1 (modified) (6 diffs)
- liboggz/trunk/doc/oggzdump.1.sgml (modified) (2 diffs)
- liboggz/trunk/src/tools/oggzdump.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
liboggz/trunk/doc/oggzdump.1
r351 r1191 1 . ..\" $Header: /var/lib/cvsd/annodex/liboggz/doc/oggzdump.1,v 1.1 2004/01/04 05:28:25 zenExp $2 . ..\"3 . ..\" transcript compatibility for postscript use.4 . ..\"5 . ..\" synopsis: .P! <file.ps>6 . ..\"1 .\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $ 2 .\" 3 .\" transcript compatibility for postscript use. 4 .\" 5 .\" synopsis: .P! <file.ps> 6 .\" 7 7 .de P! 8 8 .fl … … 16 16 \!!/showpage{}def 17 17 .fl \" prolog 18 .sy sed -e 's/^/!/' \\$1\" bring in postscript file18 .sy sed \-e 's/^/!/' \\$1\" bring in postscript file 19 19 \!!psv restore 20 20 . … … 59 59 .SH "SYNOPSIS" 60 60 .PP 61 \fBoggzdump\fR [-b | --binary ] [-x | --hexadecimal ] [-n | --new ] [-o \fBfilename\fR | --output \fBfilename\fR ] [- s \fBserialno\fR | --serialno \fBserialno\fR ] [-O | --hide-offset ] [-S | --hide-serialno ] [-G | --hide-granulepos ] [-P | --hide-packetno ] [-h | --help ] filename61 \fBoggzdump\fR [-b | --binary ] [-x | --hexadecimal ] [-n | --new ] [-o \fBfilename\fR | --output \fBfilename\fR ] [-c \fBcontent-type\fR | --content-type \fBcontent-type\fR ] [-s \fBserialno\fR | --serialno \fBserialno\fR ] [-O | --hide-offset ] [-S | --hide-serialno ] [-G | --hide-granulepos ] [-P | --hide-packetno ] [-h | --help ] filename 62 62 .PP 63 63 \fBoggzdump\fR [-r | --revert ] [-o \fBfilename\fR | --output \fBfilename\fR ] filename … … 76 76 Generate a binary dump of each packet 77 77 78 .IP "-x, --hexadeci aml" 1078 .IP "-x, --hexadecimal" 10 79 79 Generate a hexadecimal dump of each packet 80 80 … … 84 84 bitstream found; for correctly formed Ogg files, this dumps 85 85 only the beginning-of-stream packets. 86 87 .IP "-c \fBcontent-type\fR, --content-type \fBcontent-type\fR" 10 88 Dump only the logical bitstreams for a specific 89 \fBcontent-type\fR. The following codec names 90 are currently detected: "theora", "vorbis", "speex", "cmml" 86 91 87 92 .IP "-s \fBserialno\fR, --serialno \fBserialno\fR" 10 … … 148 153 \fBxxd\fP\fB(1)\fP, 149 154 \fBhexdump\fP\fB(1)\fP 150 . ..\" created by instant / docbook-to-man, Wed 19 Nov 2003, 11:46155 .\" created by instant / docbook-to-man, Wed 30 Mar 2005, 23:06 liboggz/trunk/doc/oggzdump.1.sgml
r414 r1191 80 80 81 81 <group> 82 <arg choice="opt">-c <parameter>content-type</parameter></arg> 83 <arg choice="opt">--content-type <parameter>content-type</parameter></arg> 84 </group> 85 86 <group> 82 87 <arg choice="opt">-s <parameter>serialno</parameter></arg> 83 88 <arg choice="opt">--serialno <parameter>serialno</parameter></arg> … … 161 166 bitstream found; for correctly formed Ogg files, this dumps 162 167 only the beginning-of-stream packets. 168 </para></listitem> 169 </varlistentry> 170 171 <varlistentry> 172 <term>-c <parameter>content-type</parameter>, --content-type <parameter>content-type</parameter></term> 173 <listitem><para>Dump only the logical bitstreams for a specific 174 <parameter>content-type</parameter>. The following codec names 175 are currently detected: "theora", "vorbis", "speex", "cmml" 163 176 </para></listitem> 164 177 </varlistentry> liboggz/trunk/src/tools/oggzdump.c
r1189 r1191 55 55 #define MIN(a,b) (((a)<(b))?(a):(b)) 56 56 57 typedef struct { 58 OggzTable * content_types_table; 59 OggzReadPacket read_packet; 60 } ODData; 61 57 62 static char * progname; 58 63 static FILE * outfile = NULL; 59 64 static int dump_bits = 0; 60 65 static int dump_char = 1; 61 static int dump_all_serialnos = 1;62 66 static int truth = 1; 63 67 … … 77 81 printf ("\nFiltering options\n"); 78 82 printf (" -n, --new Only dump the first packet of each logical bitstream\n"); 83 printf (" -c content-type, --content-type content-type\n"); 84 printf (" Dump only the logical bitstreams for a specified\n"); 85 printf (" content-type. The following codecs are currently\n"); 86 printf (" detected: theora, vorbis, speex, cmml\n"); 79 87 printf (" -s serialno, --serialno serialno\n"); 80 88 printf (" Dump only the logical bitstream with specified serialno\n"); … … 95 103 } 96 104 105 static ODData * 106 oddata_new () 107 { 108 ODData * oddata = malloc (sizeof (ODData)); 109 memset (oddata, 0, sizeof (ODData)); 110 111 oddata->content_types_table = oggz_table_new (); 112 113 return oddata; 114 } 115 116 static void 117 oddata_delete (ODData * oddata) 118 { 119 oggz_table_delete (oddata->content_types_table); 120 121 free (oddata); 122 } 123 97 124 static void 98 125 dump_char_line (unsigned char * buf, long n) … … 239 266 240 267 fprintf (outfile, "\n"); 268 269 return 0; 270 } 271 272 static int 273 filter_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data) 274 { 275 ODData * oddata = (ODData *) user_data; 276 const char * ident; 277 int i, n; 278 279 if (ogg_page_bos ((ogg_page *)og)) { 280 ident = ot_page_identify (og, NULL); 281 n = oggz_table_size (oddata->content_types_table); 282 for (i = 0; i < n; i++) { 283 char * c = oggz_table_nth (oddata->content_types_table, i, NULL); 284 if (strcasecmp (c, ident) == 0) { 285 oggz_set_read_callback (oggz, serialno, oddata->read_packet, NULL); 286 } 287 } 288 } 241 289 242 290 return 0; … … 391 439 int show_help = 0; 392 440 441 ODData * oddata; 393 442 OGGZ * oggz; 394 443 char * infilename = NULL, * outfilename = NULL; … … 396 445 OggzTable * table = NULL; 397 446 long serialno; 398 OggzReadPacket my_read_packet = read_packet;399 447 int i, size; 400 448 long n; 449 450 int filter_serialnos = 0; 451 int filter_content_types = 0; 401 452 402 453 ot_init (); … … 409 460 } 410 461 462 oddata = oddata_new (); 463 464 oddata->read_packet = read_packet; 465 411 466 table = oggz_table_new(); 412 467 413 468 while (1) { 414 char * optstring = "hvbxnro:s: OSGP";469 char * optstring = "hvbxnro:s:c:OSGP"; 415 470 416 471 #ifdef HAVE_GETOPT_LONG … … 424 479 {"output", required_argument, 0, 'o'}, 425 480 {"serialno", required_argument, 0, 's'}, 481 {"content-type", required_argument, 0, 'c'}, 426 482 {"hide-offset", no_argument, 0, 'O'}, 427 483 {"hide-serialno", no_argument, 0, 'S'}, … … 452 508 break; 453 509 case 'n': /* new */ 454 my_read_packet = read_new_packet;510 oddata->read_packet = read_new_packet; 455 511 break; 456 512 case 'o': /* output */ … … 461 517 break; 462 518 case 's': /* serialno */ 463 dump_all_serialnos = 0;519 filter_serialnos = 1; 464 520 serialno = atol (optarg); 465 521 oggz_table_insert (table, serialno, &truth); 522 break; 523 case 'c': /* content-type */ 524 filter_content_types = 1; 525 n = (long)oggz_table_size (oddata->content_types_table); 526 oggz_table_insert (oddata->content_types_table, (long)n, optarg); 466 527 break; 467 528 case 'O': /* hide offset */ … … 539 600 } 540 601 541 if ( dump_all_serialnos) {542 oggz_set_read_callback (oggz, -1, my_read_packet, NULL);602 if (!filter_serialnos && !filter_content_types) { 603 oggz_set_read_callback (oggz, -1, oddata->read_packet, NULL); 543 604 } else { 544 size = oggz_table_size (table); 545 for (i = 0; i < size; i++) { 546 oggz_table_nth (table, i, &serialno); 547 oggz_set_read_callback (oggz, serialno, my_read_packet, NULL); 605 if (filter_serialnos) { 606 size = oggz_table_size (table); 607 for (i = 0; i < size; i++) { 608 oggz_table_nth (table, i, &serialno); 609 oggz_set_read_callback (oggz, serialno, oddata->read_packet, NULL); 610 } 611 } 612 613 if (filter_content_types) { 614 oggz_set_read_page (oggz, -1, filter_page, oddata); 548 615 } 549 616 } … … 555 622 556 623 exit_ok: 624 oddata_delete (oddata); 557 625 oggz_table_delete (table); 558 626 exit (0); 559 627 560 628 exit_err: 629 oddata_delete (oddata); 561 630 oggz_table_delete (table); 562 631 exit (1);