ogmtools-1.5/0000755000076400234220000000000010143371303012645 5ustar mosuvj00000000000000ogmtools-1.5/p_ac3.cpp0000644000076400234220000002056507655160106014361 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_ac3.cpp AC3 output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "ac3_common.h" #include "p_ac3.h" #include "vorbis_header_utils.h" ac3_packetizer_c::ac3_packetizer_c(unsigned long nsamples_per_sec, int nchannels, int nbitrate, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) : q_c() { serialno = create_unique_serial(); ogg_stream_init(&os, serialno); packetno = 0; bytes_output = 0; memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); comments = generate_vorbis_comment(ncomments); old_granulepos = 0; packet_buffer = NULL; buffer_size = 0; eos = 0; set_params(nsamples_per_sec, nchannels, nbitrate); } ac3_packetizer_c::~ac3_packetizer_c() { ogg_stream_clear(&os); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } if (packet_buffer != NULL) free(packet_buffer); } void ac3_packetizer_c::set_params(unsigned long nsamples_per_sec, int nchannels, int nbitrate) { samples_per_sec = nsamples_per_sec; channels = nchannels; bitrate = nbitrate; } void ac3_packetizer_c::add_to_buffer(char *buf, int size) { char *new_buffer; new_buffer = (char *)realloc(packet_buffer, buffer_size + size); if (new_buffer == NULL) die("realloc"); memcpy(new_buffer + buffer_size, buf, size); packet_buffer = new_buffer; buffer_size += size; } int ac3_packetizer_c::ac3_packet_available() { int pos; ac3_header_t ac3header; if (packet_buffer == NULL) return 0; pos = find_ac3_header((unsigned char *)packet_buffer, buffer_size, &ac3header); if (pos < 0) return 0; return 1; } void ac3_packetizer_c::remove_ac3_packet(int pos, int framesize) { int new_size; char *temp_buf; new_size = buffer_size - (pos + framesize); if (new_size != 0) { temp_buf = (char *)malloc(new_size); if (temp_buf == NULL) die("malloc"); memcpy(temp_buf, &packet_buffer[pos + framesize], new_size); } else temp_buf = NULL; free(packet_buffer); packet_buffer = temp_buf; buffer_size = new_size; } char *ac3_packetizer_c::get_ac3_packet(unsigned long *header, ac3_header_t *ac3header) { int pos; char *buf; double pims; if (packet_buffer == NULL) return 0; pos = find_ac3_header((unsigned char *)packet_buffer, buffer_size, ac3header); if (pos < 0) return 0; if ((pos + ac3header->bytes) > buffer_size) return 0; pims = ((double)ac3header->bytes) * 1000.0 / ((double)ac3header->bit_rate / 8.0); if (async.displacement < 0) { /* * AC3 audio synchronization. displacement < 0 means skipping an * appropriate number of packets at the beginning. */ async.displacement += (int)pims; if (async.displacement > -(pims / 2)) async.displacement = 0; remove_ac3_packet(pos, ac3header->bytes); return 0; } if (verbose && (pos > 1)) fprintf(stdout, "ac3_packetizer: skipping %d bytes (no valid AC3 header " "found). This might make audio/video go out of sync, but this " "stream is damaged.\n", pos); buf = (char *)malloc(ac3header->bytes); if (buf == NULL) die("malloc"); memcpy(buf, packet_buffer + pos, ac3header->bytes); if (async.displacement > 0) { /* * AC3 audio synchronization. displacement > 0 is solved by duplicating * the very first AC3 packet as often as necessary. I cannot create * a packet with total silence because I don't know how, and simply * settings the packet's values to 0 does not work as the AC3 header * contains a CRC of its data. */ async.displacement -= (int)pims; if (async.displacement < (pims / 2)) async.displacement = 0; return buf; } remove_ac3_packet(pos, ac3header->bytes); return buf; } void ac3_packetizer_c::produce_header_packets() { stream_header sh; unsigned char *tempbuf; ogg_packet op; int clen, res; memset(&sh, 0, sizeof(sh)); strcpy(sh.streamtype, "audio"); memcpy(sh.subtype, "2000", 4); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, 10000000); put_uint64(&sh.samples_per_unit, samples_per_sec); put_uint32(&sh.default_len, 1); put_uint32(&sh.buffersize, samples_per_sec); put_uint16(&sh.bits_per_sample, 2); put_uint16(&sh.sh.audio.channels, channels); put_uint16(&sh.sh.audio.blockalign, 1536); put_uint32(&sh.sh.audio.avgbytespersec, bitrate * 1000 / 8); tempbuf = (unsigned char *)malloc(sizeof(sh) + 1); if (tempbuf == NULL) die("malloc"); *tempbuf = PACKET_TYPE_HEADER; memcpy((char *)&tempbuf[1], &sh, sizeof(sh)); op.packet = tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; /* submit it */ ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); free(tempbuf); /* Create the comments packet */ clen = -1 * comments_to_buffer(comments, NULL, 0); tempbuf = (unsigned char *)malloc(clen); if (tempbuf == NULL) die("malloc"); op.packet = tempbuf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; if ((res = comments_to_buffer(comments, (char *)op.packet, clen)) < 0) { fprintf(stderr, "FATAL: p_ac3: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; free(tempbuf); } int ac3_packetizer_c::process(char *buf, int size, int last_frame) { ogg_packet op; int i, tmpsize; unsigned char *bptr, *tempbuf; char *packet; unsigned long header; ac3_header_t ac3header; add_to_buffer(buf, size); while ((packet = get_ac3_packet(&header, &ac3header)) != NULL) { if (packetno == 0) { set_params(ac3header.sample_rate, ac3header.channels, ac3header.bit_rate / 1000); produce_header_packets(); } tempbuf = (unsigned char *)malloc(ac3header.bytes + 1 + sizeof(u_int16_t)); if (tempbuf == NULL) die("malloc"); tempbuf[0] = (((sizeof(u_int16_t) & 3) << 6) + ((sizeof(u_int16_t) & 4) >> 1)) | PACKET_IS_SYNCPOINT; op.bytes = ac3header.bytes + 1 + sizeof(u_int16_t); bptr = (unsigned char *)&tempbuf[1]; for (i = 0, tmpsize = 1536; i < sizeof(u_int16_t); i++) { *(bptr + i) = (unsigned char)(tmpsize & 0xFF); tmpsize = tmpsize >> 8; } memcpy(&tempbuf[1 + sizeof(u_int16_t)], packet, ac3header.bytes); op.packet = (unsigned char *)&tempbuf[0]; op.b_o_s = 0; if (last_frame && !ac3_packet_available()) { op.e_o_s = 1; eos = 1; } else op.e_o_s = 0; op.granulepos = (u_int64_t)((packetno - 2) * 1536 * async.linear); op.packetno = packetno++; ogg_stream_packetin(&os, &op); if (force_flushing) flush_pages(); bytes_output += ac3header.bytes; free(tempbuf); free(packet); } if (last_frame) { flush_pages(); return 0; } else { if (!force_flushing) queue_pages(); return EMOREDATA; } } void ac3_packetizer_c::reset() { } void ac3_packetizer_c::produce_eos_packet() { ogg_packet op; if (eos) return; op.packet = (unsigned char *)""; op.bytes = 1; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = (u_int64_t)((packetno - 2) * 1536); op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); eos = 1; } stamp_t ac3_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef INCORRECT_INTERLEAVING stamp = (stamp_t)((double)old_granulepos * (double)1000000.0 / (double)samples_per_sec); old_granulepos = granulepos; #else stamp = (stamp_t)((double)granulepos * 1000000.0 / (double)samples_per_sec); #endif return stamp; } ogmtools-1.5/ogmsplit.cpp0000644000076400234220000010664707757237160015250 0ustar mosuvj00000000000000/* ogmsplit -- utility for splitting an OGG media file Written by Moritz Bunkus Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include #include #include #include #include #define OGMSPLIT #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "vorbis_header_utils.h" #define BLOCK_SIZE 4096 #define PM_FINDSPLITPOINTS 1 #define PM_PRINTSPLITPOINTS 2 class split_packetizer_c: public q_c { private: ogg_int64_t old_granulepos; char stype; double sample_rate; public: split_packetizer_c(double nsample_rate, ogg_stream_state *ostate, char nstype); virtual ~split_packetizer_c(); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void process(ogg_packet *op); virtual void produce_eos_packet() {}; virtual void produce_header_packets() {}; virtual void reset() {}; }; typedef struct stream_t { int serial; int eos, comment; char stype; ogg_stream_state instate; ogg_stream_state outstate; ogg_packet header_packet1; ogg_packet header_packet2; ogg_packet header_packet3; ogg_int64_t last_granulepos, this_granulepos; ogg_int64_t granulepos; ogg_int64_t packetno; ogg_int64_t num_frames, cur_frame; double sample_rate, granulepossub; vorbis_comment vc; int vc_unpacked; ogmmerge_page_t *mpage; split_packetizer_c *pzr; struct stream_t *next; } stream_t; typedef struct splitpoint_t { ogg_int64_t pos_bytes; double pos_time; ogg_int64_t frameno; } splitpoint_t; typedef struct cut_t { double start; double end; struct cut_t *next; } cut_t; stream_t *first = NULL, *vstream = NULL; int numstreams = 0; ogg_int64_t bread = 0; ogg_int64_t bwritten = 0, bwritten_all = 0; ogg_int64_t split_bytes = -1; double last_split = 0.0, current_time = 0.0; double split_time = -1.0; splitpoint_t *splitpoints = NULL; int num_splitpoints = 0, next_sp = -1; int cut_mode = 0; cut_t *cuts = NULL, *current_cut = NULL; int print_mode = 0; int count_only = 0; int frontend_mode = 0; FILE *fout; char *fout_base, *fout_ext; int fout_num = 1; int max_num_files = INT_MAX; int verbose = 0; off_t file_size; int last_percent = 0; /* * split_packetizer class functions */ split_packetizer_c::split_packetizer_c(double nsample_rate, ogg_stream_state *ostate, char nstype) { old_granulepos = 0; stype = nstype; sample_rate = nsample_rate; memcpy(&os, ostate, sizeof(ogg_stream_state)); } split_packetizer_c::~split_packetizer_c() { } stamp_t split_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef XIPHCORRECTINTERLEAVING if (stype == 't') stamp = (stamp_t)((double)granulepos * (double)1000000.0 / sample_rate); else #endif stamp = (stamp_t)((double)old_granulepos * (double)1000000.0 / sample_rate); old_granulepos = granulepos; return stamp; } void split_packetizer_c::process(ogg_packet *op) { ogg_stream_packetin(&os, op); queue_pages(); } /* * General helper functions, usage */ void usage(char *fname) { fprintf(stdout, "Usage: %s [options] inname\n\n" " options:\n" " inname Use 'inname' as the source.\n" " -o, --output out Use 'out' as the base name. Ascending part numbers\n" " will be appended to it. Default is 'inname'.\n" " The operation mode can be set with exactly one of -s, -t, -c or -p.\n" " The default mode is to split by size (-s).\n" " -s, --size size Size in MiB ( = 1024 * 1024 bytes) after which a new\n" " file will be opened (approximately). Default is 700MiB." "\n Size can end in 'B' or 'b' to indicate 'bytes'\n" " instead of 'MiB'.\n" " -t, --time time Split after the given elapsed time (approximately).\n" " 'time' takes the form HH:MM:SS.sss or simply SS(.sss),\n" " e.g. 00:05:00.000 or 300.000 or simply 300.\n" " -c, --cuts cuts Produce output files as specified by cuts, a list of\n" " slices of the form \"start-end\" or \"start+length\",\n" " separated by commas. If start is omitted, it defaults\n" " to the end of the previous cut. start and end take\n" " the same format as the arguments to \"-t\".\n" " -p, --print-splitpoints Only print the key frames and the number of\n" " bytes encountered before each. Useful to find the\n" " exact splitting point.\n" " -n, --num num Don't create more than num separate files. The last one" "\n may be bigger than the desired size. Default is an\n" " unlimited number. Can only be used with -s or -t.\n" " --frontend Frontend mode. Progress output will be terminated by\n" " \\n instead of \\r.\n" " -v, --verbose Be verbose and show each OGG packet.\n" " Can be used twice to increase verbosity.\n" " -h, --help Show this help.\n" " -V, --version Show version information.\n", fname); } void print_progress(ogg_int64_t current, ogg_int64_t num, char *s) { if (frontend_mode) fprintf(stdout, "Processing %s %lld/%lld (%lld%%)\n", s, current, num, current * 100 / num); else fprintf(stdout, "Processing %s %lld/%lld (%lld%%)\r", s, current, num, current * 100 / num); fflush(stdout); } double parse_time(char *s) { char *c, *a, *dot; int num_colons; double seconds; dot = strchr(s, '.'); if (dot != NULL) { *dot = 0; dot++; } for (c = s, num_colons = 0; *c; c++) { if (*c == ':') num_colons++; else if ((*c < '0') || (*c > '9')) { fprintf(stderr, "ERROR: illegal character '%c' in time range.\n", *c); exit(1); } } if (num_colons > 2) { fprintf(stderr, "ERROR: illegal time range: %s.\n", s); exit(1); } if (num_colons == 0) { seconds = strtod(s, NULL); if (dot != NULL) seconds += strtod(dot, NULL) / 1000.0; } for (a = s, c = s, seconds = 0; *c; c++) { if (*c == ':') { *c = 0; seconds *= 60; seconds += atoi(a); a = c + 1; } } seconds *= 60; seconds += atoi(a); if (dot != NULL) seconds += strtod(dot, NULL) / 1000.0; return seconds; } void copy_ogg_packet(ogg_packet *dst, ogg_packet *src) { memcpy(dst, src, sizeof(ogg_packet)); dst->packet = (unsigned char *)malloc(src->bytes); if (dst->packet == NULL) die("malloc"); memcpy(dst->packet, src->packet, src->bytes); } /* * File handling */ void open_out_file() { char *buf; buf = (char *)malloc(strlen(fout_base) + strlen(fout_ext) + 16); sprintf(buf, "%s-%06d.%s", fout_base, fout_num++, fout_ext); fout = fopen(buf, "w"); if (fout == NULL) { fprintf(stderr, "(%s) Could not open '%s' for writing (%s).\n", __FILE__, buf, strerror(errno)); exit(1); } if (verbose) fprintf(stdout, "(%s) Starting new file '%s'.\n", __FILE__, buf); free(buf); bwritten = 0; } void write_page(ogg_page *page) { int ih, ib; if (!print_mode && !count_only) { if (fout == NULL) return; ih = fwrite(page->header, 1, page->header_len, fout); ib = fwrite(page->body, 1, page->body_len, fout); } else { ih = page->header_len; ib = page->body_len; } bwritten += ih + ib; bwritten_all += ih + ib; if ((verbose > 1) && !print_mode && !count_only) fprintf(stdout, "(%s) %d + %d bytes written\n", __FILE__, ih, ib); } void flush_pages(stream_t *stream) { ogmmerge_page_t *mpage; ogg_page *page; stream->pzr->flush_pages(); if (stream->mpage == NULL) stream->mpage = stream->pzr->get_page(); while (stream->mpage != NULL) { mpage = stream->mpage; page = mpage->og; write_page(page); free(page->header); free(page->body); free(page); free(mpage); stream->mpage = stream->pzr->get_page(); } } int pages_available() { stream_t *stream; int eos_only; eos_only = 1; stream = first; while (stream != NULL) { if (stream->mpage != NULL) { stream = stream->next; eos_only = 0; continue; } if (stream->pzr->page_available()) { stream->mpage = stream->pzr->get_page(); stream = stream->next; eos_only = 0; continue; } if (!stream->eos) return 0; stream = stream->next; } return 1 - eos_only; } void write_winner_page() { stream_t *winner, *cur; winner = first; cur = first->next; while (cur != NULL) { if (cur->mpage != NULL) { if (winner->mpage == NULL) winner = cur; else if (cur->mpage && (cur->mpage->timestamp < winner->mpage->timestamp)) winner = cur; } cur = cur->next; } if (winner->mpage != NULL) { write_page(winner->mpage->og); free(winner->mpage->og->header); free(winner->mpage->og->body); free(winner->mpage->og); free(winner->mpage); winner->mpage = NULL; } } void write_all_winner_pages() { while (pages_available()) write_winner_page(); } void flush_all_streams() { stream_t *s; s = first; while (s != NULL) { flush_pages(s); s = s->next; } } void produce_eos_packets() { stream_t *s; ogg_packet p; s = first; while (s != NULL) { if (!s->eos) { p.packet = (unsigned char *)""; p.bytes = 1; p.e_o_s = 1; p.b_o_s = 0; p.packetno = s->packetno++; p.granulepos = s->this_granulepos - (ogg_int64_t)s->granulepossub; s->pzr->process(&p); s->eos = 1; } s = s->next; } write_all_winner_pages(); } void write_stream_headers() { stream_t *stream; stream = first; while (stream != NULL) { delete(stream->pzr); if (stream->mpage != NULL) { free(stream->mpage->og->header); free(stream->mpage->og->body); free(stream->mpage->og); free(stream->mpage); stream->mpage = NULL; } ogg_stream_init(&stream->outstate, stream->serial); stream->pzr = new split_packetizer_c(stream->sample_rate, &stream->outstate, stream->stype); stream->eos = 0; stream->granulepos = 0; stream->pzr->process(&stream->header_packet1); flush_pages(stream); stream = stream->next; } stream = first; while (stream != NULL) { if ((stream->stype == 'v') && stream->vc_unpacked && !print_mode) { vorbis_comment *new_vc; int clen, res; unsigned char *buf; ogg_packet op; if (cut_mode && (current_cut != NULL)) new_vc = chapter_information_adjust(&stream->vc, current_cut->start, current_cut->end); else if (!cut_mode) { if ((next_sp != -1) && (fout_num <= max_num_files)) new_vc = chapter_information_adjust(&stream->vc, current_time, splitpoints[next_sp].pos_time); else new_vc = chapter_information_adjust(&stream->vc, current_time, 9999999999.0); } else new_vc = vorbis_comment_dup(&stream->vc); clen = -1 * comments_to_buffer(new_vc, NULL, 0); buf = (unsigned char *)malloc(clen); if (buf == NULL) die("malloc"); if ((res = comments_to_buffer(new_vc, (char *)buf, clen)) < 0) { fprintf(stderr, "FATAL: ogmsplit: comments_to_buffer failed. clen " "is %d, result was %d.\n", clen, res); exit(1); } op.packet = buf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; stream->pzr->process(&op); free(buf); vorbis_comment_clear(new_vc); free(new_vc); } else stream->pzr->process(&stream->header_packet2); if (stream->stype != 'V') flush_pages(stream); stream->packetno = 2; stream = stream->next; } stream = first; while (stream != NULL) { if (stream->stype == 'V') { stream->pzr->process(&stream->header_packet3); flush_pages(stream); stream->packetno = 3; } stream = stream->next; } } long get_queued_bytes() { long bytes; stream_t *stream; stream = first; bytes = 0; while (stream != NULL) { bytes += stream->pzr->get_queued_bytes(); stream = stream->next; } return bytes; } /* * stream and splitpoint adding and finding */ void add_stream(stream_t *ndmx) { stream_t *cur = first; if (first == NULL) { first = ndmx; first->next = NULL; } else { cur = first; while (cur->next != NULL) cur = cur->next; cur->next = ndmx; ndmx->next = NULL; } } stream_t *find_stream(int fserial) { stream_t *cur = first; while (cur != NULL) { if (cur->serial == fserial) break; cur = cur->next; } return cur; } void add_splitpoint(splitpoint_t *sp) { splitpoints = (splitpoint_t *)realloc(splitpoints, (num_splitpoints + 1) * sizeof(splitpoint_t)); if (splitpoints == NULL) die("realloc"); memcpy(&splitpoints[num_splitpoints], sp, sizeof(splitpoint_t)); num_splitpoints++; } int find_next_splitpoint(int start) { int i; if (start == -1) return -1; for (i = start + 1; i < num_splitpoints; i++) { if ((split_bytes > 0) && ((bwritten_all + split_bytes) < splitpoints[i].pos_bytes)) return i - 1; if ((split_time > 0) && ((current_time + split_time + 1) < splitpoints[i].pos_time)) return i - 1; } return -1; } /* * all-mighty processing function */ void process_ogm(int fdin) { ogg_sync_state sync; ogg_page page; ogg_packet pack; int nread, np, sno, endofstream; stream_t *stream; char *buf; vorbis_info vi; vorbis_comment vc; int hdrlen, i; long lenbytes; splitpoint_t sp; int do_close = 0, do_open = 0; ogg_sync_init(&sync); while (1) { np = ogg_sync_pageseek(&sync, &page); if (np < 0) { fprintf(stderr, "(%s) ogg_sync_pageseek failed\n", __FILE__); return; } if (np == 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); if (!buf) { fprintf(stderr, "(%s) ogg_sync_buffer failed\n", __FILE__); return; } if ((nread = read(fdin, buf, BLOCK_SIZE)) <= 0) return; ogg_sync_wrote(&sync, nread); bread += nread; continue; } if (!ogg_page_bos(&page)) { break; } else { if (print_mode) { stream = (stream_t *)malloc(sizeof(stream_t)); if (stream == NULL) die("malloc"); memset(stream, 0, sizeof(stream_t)); stream->serial = ogg_page_serialno(&page); if (ogg_stream_init(&stream->instate, stream->serial)) { fprintf(stderr, "(%s) ogg_stream_init failed\n", __FILE__); return; } add_stream(stream); ogg_stream_pagein(&stream->instate, &page); ogg_stream_packetout(&stream->instate, &pack); copy_ogg_packet(&stream->header_packet1, &pack); ogg_stream_init(&stream->outstate, stream->serial); if ((pack.bytes >= 7) && !strncmp((char *)&pack.packet[1], "vorbis", 6)) { stream->stype = 'V'; vorbis_info_init(&vi); vorbis_comment_init(&vc); if (vorbis_synthesis_headerin(&vi, &vc, &pack) >= 0) stream->sample_rate = vi.rate; else { fprintf(stderr, "(%s) Vorbis audio stream indicated " \ "but no Vorbis stream header found.\n", __FILE__); exit(1); } } else if (((*pack.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER) && (pack.bytes >= (int)(sizeof(old_stream_header) + 1))) { stream_header sth; copy_headers(&sth, (old_stream_header *)&pack.packet[1], pack.bytes); if (!strncmp(sth.streamtype, "video", 5)) { stream->sample_rate = (double)10000000 / (double)get_uint64(&sth.time_unit); stream->stype = 'v'; if (vstream == NULL) vstream = stream; } else if (!strncmp(sth.streamtype, "audio", 5)) { stream->sample_rate = get_uint64(&sth.samples_per_unit); stream->stype = 'a'; } else if (!strncmp(sth.streamtype, "text", 4)) { stream->stype = 't'; stream->sample_rate = (double)10000000 / (double)get_uint64(&sth.time_unit); } else { fprintf(stderr, "(%s) Found new header of unknown/" \ "unsupported type\n", __FILE__); exit(1); } } else { fprintf(stderr, "(%s) Found unknown header.\n", __FILE__); exit(1); } stream->pzr = new split_packetizer_c(stream->sample_rate, &stream->outstate, stream->stype); stream->pzr->process(&pack); flush_pages(stream); stream->packetno++; } else { stream = find_stream(ogg_page_serialno(&page)); if (stream == NULL) { fprintf(stderr, "(%s) Stream info has changed since the first pass." " First pass did not record information about stream number " "%d.\n", __FILE__, ogg_page_serialno(&page)); exit(1); } ogg_stream_init(&stream->instate, stream->serial); ogg_stream_pagein(&stream->instate, &page); ogg_stream_packetout(&stream->instate, &pack); ogg_stream_init(&stream->outstate, stream->serial); stream->pzr = new split_packetizer_c(stream->sample_rate, &stream->outstate, stream->stype); stream->eos = 0; stream->comment = 0; } } } if (vstream == NULL) { fprintf(stderr, "(%s) Found no video stream. Not splitting.\n", __FILE__); exit(1); } if (verbose <= 1) { if (print_mode & PM_FINDSPLITPOINTS) print_progress(0, file_size, "bytes"); else if (!print_mode) print_progress(0, vstream->num_frames, "frame"); } endofstream = 0; if (!print_mode && !cut_mode) next_sp = find_next_splitpoint(0); while (!endofstream) { sno = ogg_page_serialno(&page); stream = find_stream(sno); if (stream == NULL) { if (verbose > 1) fprintf(stdout, "(%s) Encountered packet for an unknown serial " \ "%d !?\n", __FILE__, sno); } else { ogg_stream_pagein(&stream->instate, &page); stream->last_granulepos = stream->this_granulepos; stream->this_granulepos = ogg_page_granulepos(&page); while (ogg_stream_packetout(&stream->instate, &pack) == 1) { if (stream->stype != 'V') { if (stream->comment == 0) { if (print_mode) { copy_ogg_packet(&stream->header_packet2, &pack); if (stream->stype == 'v') { vorbis_unpack_comment(&stream->vc, (char *)pack.packet, pack.bytes); stream->vc_unpacked = 1; } } stream->comment = 1; stream->packetno = 2; continue; } } else { if (stream->comment == 0) { if (print_mode) copy_ogg_packet(&stream->header_packet2, &pack); stream->comment = 1; continue; } else if (stream->comment == 1) { if (print_mode) copy_ogg_packet(&stream->header_packet3, &pack); stream->comment = 2; stream->packetno = 3; continue; } } if (pack.granulepos == -1) pack.granulepos = stream->this_granulepos; current_time = (double)stream->last_granulepos * 1000.0 / stream->sample_rate; if (cut_mode) { if ((current_cut != NULL) && (fout == NULL) && (current_time == 0) && (current_cut->start == 0.0) && !print_mode) { open_out_file(); write_stream_headers(); } if ((current_cut != NULL) && (current_time >= current_cut->end) && (fout != NULL)) do_close = 1; } else if ((fout == NULL) && !print_mode) { open_out_file(); write_stream_headers(); do_open = 0; } if ((stream->stype == 'v') && (pack.packet[0] & PACKET_IS_SYNCPOINT)) { stream->pzr->flush_pages(); if (print_mode && (vstream == stream)) { ogg_int64_t pts = (ogg_int64_t)current_time; sp.pos_time = current_time; sp.pos_bytes = bwritten + get_queued_bytes(); sp.frameno = stream->granulepos; add_splitpoint(&sp); if (print_mode & PM_PRINTSPLITPOINTS) fprintf(stdout, "(%s) Split point: %d, frameno: %lld, " "bytes: %lld, start: %02d:%02d:%02d.%03d\n", __FILE__, num_splitpoints - 1, stream->granulepos, bwritten + get_queued_bytes(), (int)(pts / 3600000), (int)(pts / 60000) % 60, (int)(pts / 1000) % 60, (int)(pts % 1000)); } else if (cut_mode) { if ((current_cut != NULL) && (fout == NULL) && (current_time >= current_cut->start)) do_open = 1; } else if (!print_mode && (fout_num <= max_num_files) && (next_sp != -1) && ( ((split_bytes > 0) && ((bwritten_all + get_queued_bytes()) >= splitpoints[next_sp].pos_bytes) ) || ( (split_time > 0) && (current_time >= splitpoints[next_sp].pos_time) ) )) { do_open = 1; do_close = 1; } } if (stream->stype == 'v') { if (do_close && !print_mode) { produce_eos_packets(); if (fout != NULL) { fclose(fout); fout = NULL; } if (verbose) { ogg_int64_t sst = (ogg_int64_t)current_time; ogg_int64_t tf = (ogg_int64_t)(current_time - last_split); fprintf(stdout, "\n(%s) Closing file after writing %lld bytes " "(%lld bytes written in all files), %02d:%02d:%02d.%03d " "in this file (%02d:%02d:%02d.%03d elapsed).\n", __FILE__, bwritten, bwritten_all, (int)(tf / 3600000), (int)(tf / 60000) % 60, (int)(tf / 1000) % 60, (int)(tf % 1000), (int)(sst / 3600000), (int)(sst / 60000) % 60, (int)(sst / 1000) % 60, (int)(sst % 1000)); } if (cut_mode) { if (current_cut != NULL) current_cut = current_cut->next; if (current_cut == NULL) return; } } if (do_open && !print_mode) { stream_t *cur; if (!cut_mode) next_sp = find_next_splitpoint(next_sp); open_out_file(); write_stream_headers(); last_split = current_time; cur = first; while (cur != NULL) { cur->granulepossub = current_time * cur->sample_rate / 1000.0; cur = cur->next; } } do_open = 0; do_close = 0; hdrlen = (*pack.packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*pack.packet & PACKET_LEN_BITS2) << 1; lenbytes = 1; if ((hdrlen > 0) && (pack.bytes >= (hdrlen + 1))) for (i = 0, lenbytes = 0; i < hdrlen; i++) { lenbytes = lenbytes << 8; lenbytes += *((unsigned char *)pack.packet + hdrlen - i); } pack.granulepos = stream->granulepos + lenbytes - 1; stream->granulepos += lenbytes; if (print_mode) stream->num_frames += lenbytes; else { stream->cur_frame += lenbytes; if ((verbose <= 1) && (stream->cur_frame % (stream->num_frames / 100) == 0)) print_progress(stream->cur_frame, stream->num_frames, "frame"); } } else pack.granulepos -= (ogg_int64_t)stream->granulepossub; pack.packetno = stream->packetno++; if (pack.e_o_s) stream->eos = 1; if (!cut_mode || ((current_cut != NULL) && (current_time >= current_cut->start))) { stream->pzr->process(&pack); if (stream->stype == 't') stream->pzr->flush_pages(); } else { count_only = 1; stream->pzr->process(&pack); if (stream->stype == 't') stream->pzr->flush_pages(); } write_all_winner_pages(); count_only = 0; } } while (ogg_sync_pageseek(&sync, &page) <= 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); nread = read(fdin, buf, BLOCK_SIZE); if (nread <= 0) { endofstream = 1; break; } else { ogg_sync_wrote(&sync, nread); bread += nread; if ((print_mode & PM_FINDSPLITPOINTS) && (verbose <= 1) && (last_percent != (int)((double)bread * 100.0 / (double)file_size))) { print_progress(bread, file_size, "bytes"); last_percent = (int)((double)bread * 100.0 / (double)file_size); } } } } produce_eos_packets(); if (!print_mode) { fclose(fout); if (verbose) { ogg_int64_t sst = (ogg_int64_t)current_time; ogg_int64_t tf = (ogg_int64_t)(current_time - last_split); fprintf(stdout, "(%s) Closing file after writing %lld bytes " "(%lld bytes written in all files), %02d:%02d:%02d.%03d " "in this file (%02d:%02d:%02d.%03d elapsed).\n", __FILE__, bwritten, bwritten_all, (int)(tf / 3600000), (int)(tf / 60000) % 60, (int)(tf / 1000) % 60, (int)(tf % 1000), (int)(sst / 3600000), (int)(sst / 60000) % 60, (int)(sst / 1000) % 60, (int)(sst % 1000)); } } stream = first; while (stream != NULL) { delete(stream->pzr); stream->mpage = NULL; stream = stream->next; } ogg_sync_clear(&sync); if ((verbose <= 1) && !print_mode) { print_progress(vstream->cur_frame, vstream->num_frames, "frame"); if (!frontend_mode) fprintf(stdout, "\n"); } else if ((verbose <= 1) && (print_mode & PM_FINDSPLITPOINTS)) { print_progress(file_size, file_size, "bytes"); if (!frontend_mode) fprintf(stdout, "\n"); } } int main(int argc, char *argv[]) { int i, fdin = -1, byte_mode = 0; char *fin_name, *b, *fout_name = NULL; ogg_int64_t unit; nice(2); for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { fprintf(stdout, "ogmsplit v" VERSION "\n"); exit(0); } for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) verbose++; else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { usage(argv[0]); return 0; } else if (!strcmp(argv[i], "--frontend")) frontend_mode = 1; else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--size")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -s requires an argument.\n", __FILE__); exit(1); } b = &argv[i + 1][0]; while (isspace(*b) || isdigit(*b)) b++; unit = 1024 * 1024; if (!strcasecmp(b, "mib") || !strcasecmp(b, "mb")) unit = 1024 * 1024; else if (!strcasecmp(b, "b")) unit = 1; else if (*b != 0) { fprintf(stderr, "(%s) '%s' is not a valid size.\n", __FILE__, argv[i + 1]); exit(1); } *b = 0; byte_mode = 1; split_bytes = (ogg_int64_t)strtol(argv[i + 1], NULL, 10) * unit; if (split_bytes <= 0) { fprintf(stderr, "(%s) '%s' is not a valid size.\n", __FILE__, argv[i + 1]); exit(1); } i++; } else if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--time")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -t requires an argument.\n", __FILE__); exit(1); } split_time = parse_time(argv[i + 1]); if (split_time <= 0.0) { fprintf(stderr, "(%s) '%s' is not a valid time.\n", __FILE__, argv[i + 1]); exit(1); } i++; split_time *= 1000.0; } else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--cuts")) { char *p; double last_cut_end = 0.0; cut_t **last_cut = &cuts; if ((i + 1) >= argc) { fprintf(stderr, "(%s) -c requires an argument.\n", __FILE__); exit(1); } p = argv[i + 1]; while (1) { char *next, *sep, sepc; cut_t *cut; cut = (cut_t *)malloc(sizeof(cut_t)); if (cut == NULL) die("malloc"); cut->start = last_cut_end; next = strchr(p, ','); if (next != NULL) *next = '\0'; sep = strchr(p, '-'); if (sep == NULL) sep = strchr(p, '+'); if (sep == NULL) { fprintf(stderr, "(%s) -c argument must be of the form start-end " "or start+len. Either start or end can be omitted.\n", __FILE__); exit(1); } sepc = *sep; *sep = '\0'; if (sep != p) cut->start = parse_time(p) * 1000.0; if (sepc == '-') { if (*(sep + 1) == 0) cut->end = 999999 * 1000.0; else cut->end = parse_time(sep + 1) * 1000.0; } else { if (*(sep + 1) == 0) { fprintf(stderr, "(%s) -c argument must be of the form start-end " "or start+len. Either start or end can be omitted.\n", __FILE__); exit(1); } cut->end = cut->start + 1000.0 * parse_time(sep + 1); } if ((cut->start < last_cut_end) || (cut->start >= cut->end)) { fprintf(stderr, "(%s) -c arguments must be in order and not " "overlapping\n", __FILE__); exit(1); } last_cut_end = cut->end; *last_cut = cut; last_cut = &cut->next; cut->next = NULL; if (!next) break; p = next + 1; } cut_mode = 1; i++; current_cut = cuts; } else if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--output")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -o requires an argument.\n", __FILE__); exit(1); } fout_name = argv[i + 1]; i++; } else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--num")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -n requires an argument.\n", __FILE__); exit(1); } max_num_files = atoi(argv[i + 1]); if (max_num_files <= 0) { fprintf(stderr, "(%s) '%s' is not a valid number for -n.\n", __FILE__, argv[i + 1]); exit(1); } i++; } else if (!strcmp(argv[i], "-p") || !strcmp(argv[i], "--print-splitpoints")) print_mode = 3; else { if (fdin != -1) { fprintf(stderr, "(%s) Only one input file allowed.\n", __FILE__); exit(1); } fdin = open(argv[i], O_RDONLY); if (fdin == -1) { fprintf(stderr, "(%s) Could not open \"%s\".\n", __FILE__, argv[i]); return 1; } fin_name = argv[i]; file_size = lseek(fdin, 0, SEEK_END); if (file_size == (off_t)-1) { fprintf(stderr, "(%s) Could not seek to end of file.\n", __FILE__); return 1; } lseek(fdin, 0, SEEK_SET); } } if (cut_mode) { if ((split_time > 0.0) || (split_bytes > 0) || print_mode) { fprintf(stderr, "(%s) -c must not be used together with -t, -s or -p.\n", __FILE__); exit(1); } if (max_num_files != INT_MAX) { fprintf(stderr, "(%s) -n has no effect if -c is used.\n", __FILE__); exit(1); } } else { if ((split_time > 0.0) && (split_bytes > 0)) { fprintf(stderr, "(%s) -t and -s are mutually exclusive.\n", __FILE__); exit(1); } else if (print_mode && ((split_time > 0.0) || (split_bytes > 0))) { fprintf(stderr, "(%s) -p must not be used together with -t or -s.\n", __FILE__); exit(1); } if ((split_time < 0.0) && (split_bytes < 0)) split_bytes = 700 * 1024 * 1024; } if (fdin == -1) { usage(argv[0]); exit(1); } if (fout_name == NULL) fout_name = strdup(fin_name); b = &fout_name[strlen(fout_name) - 1]; while ((b != fout_name) && (*b != '.')) b--; fout_base = fout_name; if (*b == '.') { *b = 0; b++; fout_ext = b; } else fout_ext = "ogm"; if (print_mode) { fprintf(stdout, "(%s) Will only print key frame numbers and the number " "of bytes encountered before each key frame. Will NOT create " "any file.\n", __FILE__); process_ogm(fdin); } else { if (verbose && !cut_mode) { fprintf(stdout, "(%s) Going to split \"%s\" to \"%s-00...%s\", " \ "maximum number of files: ", __FILE__, fin_name, fout_base, fout_ext); if (max_num_files == INT_MAX) fprintf(stdout, "unlimited"); else fprintf(stdout, "%d", max_num_files); fprintf(stdout, ", split after "); if (split_time < 0.0) { if (!byte_mode) fprintf(stdout, "%.2fMiB.\n", (double)split_bytes / 1024.0 / 1024.0); else fprintf(stdout, "%lldbytes.\n", split_bytes); } else fprintf(stdout, "%.3fs.\n", split_time / 1000.0); } fprintf(stdout, "(%s) First pass: finding split points. This may take " "a while. Get something to drink.\n", __FILE__); print_mode = PM_FINDSPLITPOINTS; process_ogm(fdin); print_mode = 0; bwritten_all = 0; bwritten = 0; bread = 0; current_time = 0; last_split = 0; close(fdin); if (!cut_mode && (num_splitpoints <= 1)) { fprintf(stdout, "(%s) No split points found - nothing to do.\n", __FILE__); exit(0); } fdin = open(fin_name, O_RDONLY); if (fdin == -1) { fprintf(stderr, "(%s) Could not re-open \"%s\".\n", __FILE__, fin_name); return 1; } fprintf(stdout, "(%s) Second pass: splitting the file. This will take " "even longer. Go and have a nice chat with your girlfriend.\n", __FILE__); process_ogm(fdin); close(fdin); } return 0; } ogmtools-1.5/p_pcm.cpp0000644000076400234220000001436707655160106014475 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_pcm.cpp raw & uncompressed PCM output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "p_pcm.h" #include "vorbis_header_utils.h" pcm_packetizer_c::pcm_packetizer_c(unsigned long nsamples_per_sec, int nchannels, int nbits_per_sample, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) : q_c() { serialno = create_unique_serial(); ogg_stream_init(&os, serialno); packetno = 0; bps = nchannels * nbits_per_sample * nsamples_per_sec / 8; tempbuf = (char *)malloc(bps + 128); if (tempbuf == NULL) die("malloc"); samples_per_sec = nsamples_per_sec; channels = nchannels; bits_per_sample = nbits_per_sample; bytes_output = 0; memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); comments = generate_vorbis_comment(ncomments); old_granulepos = 0; } pcm_packetizer_c::~pcm_packetizer_c() { ogg_stream_clear(&os); if (tempbuf != NULL) free(tempbuf); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } } void pcm_packetizer_c::reset() { } void pcm_packetizer_c::produce_header_packets() { ogg_packet op; stream_header sh; int clen, res; memset(&sh, 0, sizeof(sh)); strcpy(sh.streamtype, "audio"); memcpy(sh.subtype, "0001", 4); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, 10000000); put_uint64(&sh.samples_per_unit, samples_per_sec); put_uint32(&sh.default_len, 1); put_uint32(&sh.buffersize, bps); put_uint16(&sh.bits_per_sample, bits_per_sample); put_uint16(&sh.sh.audio.channels, channels); put_uint16(&sh.sh.audio.blockalign, channels * bits_per_sample / 8); put_uint32(&sh.sh.audio.avgbytespersec, sh.buffersize); *((unsigned char *)tempbuf) = PACKET_TYPE_HEADER; memcpy((char *)&tempbuf[1], &sh, sizeof(sh)); op.packet = (unsigned char *)tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; /* submit it */ ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); /* Create the comments packet */ clen = -1 * comments_to_buffer(comments, NULL, 0); op.packet = (unsigned char *)tempbuf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; if ((res = comments_to_buffer(comments, (char *)op.packet, clen)) < 0) { fprintf(stderr, "FATAL: p_pcm: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; } int pcm_packetizer_c::process(char *buf, int size, int last_frame) { ogg_packet op; int i; int start, j; u_int16_t samp_in_subpacket; unsigned char *bptr; int bytes_per_subpacket; int remaining_bytes; int complete_subpackets; if (size > bps) { fprintf(stderr, "FATAL: pcm_packetizer: size (%d) > bps (%d)\n", size, bps); exit(1); } if (packetno == 0) produce_header_packets(); bytes_per_subpacket = bps / pcm_interleave; complete_subpackets = size / bytes_per_subpacket; remaining_bytes = size % bytes_per_subpacket; memcpy(&tempbuf[1 + sizeof(samp_in_subpacket)], buf, size); for (i = 0; i < complete_subpackets; i++) { int last_packet = 0; if (last_frame && (i == (complete_subpackets - 1)) && (remaining_bytes == 0)) last_packet = 1; start = i * bytes_per_subpacket; samp_in_subpacket = bytes_per_subpacket * 8 / bits_per_sample / channels; tempbuf[start] = ((sizeof(samp_in_subpacket) & 3) << 6) + ((sizeof(samp_in_subpacket) & 4) >> 1); tempbuf[start] |= (i == 0 ? PACKET_IS_SYNCPOINT : 0); op.bytes = bytes_per_subpacket + 1 + sizeof(samp_in_subpacket); bptr = (unsigned char *)&tempbuf[start + 1]; for (j = 0; j < sizeof(samp_in_subpacket); j++) { *(bptr + j) = (unsigned char)(samp_in_subpacket & 0xFF); samp_in_subpacket = samp_in_subpacket >> 8; } op.packet = (unsigned char *)&tempbuf[start]; op.b_o_s = 0; op.e_o_s = last_packet; op.granulepos = (u_int64_t)(bytes_output * 8 / bits_per_sample / channels); op.packetno = packetno++; ogg_stream_packetin(&os, &op); bytes_output += bytes_per_subpacket; } if (remaining_bytes) { int last_packet = last_frame; start = complete_subpackets * bytes_per_subpacket; samp_in_subpacket = remaining_bytes * 8 / bits_per_sample / channels; tempbuf[start] = ((sizeof(samp_in_subpacket) & 3) << 6) + ((sizeof(samp_in_subpacket) & 4) >> 1); tempbuf[start] |= (i == 0 ? PACKET_IS_SYNCPOINT : 0); op.bytes = remaining_bytes + 1 + sizeof(samp_in_subpacket); bptr = (unsigned char *)&tempbuf[start + 1]; for (j = 0; j < sizeof(samp_in_subpacket); j++) { *(bptr + j) = (unsigned char)(samp_in_subpacket & 0xFF); samp_in_subpacket = samp_in_subpacket >> 8; } op.packet = (unsigned char *)&tempbuf[start]; op.b_o_s = 0; op.e_o_s = last_packet; op.granulepos = (u_int64_t)(bytes_output * 8 / bits_per_sample / channels); op.packetno = packetno++; ogg_stream_packetin(&os, &op); bytes_output += remaining_bytes; } if (last_frame) flush_pages(); else queue_pages(); return EMOREDATA; } void pcm_packetizer_c::produce_eos_packet() { char buf = 0; process(&buf, 1, 1); } stamp_t pcm_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef INCORRECT_INTERLEAVING stamp = (stamp_t)((double)old_granulepos * 1000000.0 / (double)samples_per_sec); old_granulepos = granulepos; #else stamp = (stamp_t)((double)granulepos * 1000000.0 / (double)samples_per_sec); #endif return stamp; } ogmtools-1.5/debian/0000755000076400234220000000000010143371274014076 5ustar mosuvj00000000000000ogmtools-1.5/debian/control0000644000076400234220000000114510012131420015460 0ustar mosuvj00000000000000Source: ogmtools Section: graphics Priority: optional Maintainer: Moritz Bunkus Build-Depends: debhelper (>> 3.0.0), libvorbis-dev, libdvdread3-dev Standards-Version: 3.5.2 Package: ogmtools Architecture: any Depends: ${shlibs:Depends} Description: Tools for manipulating Ogg multimedia streams These tools manipulate Ogg media streams: ogminfo - displays stream information ogmdemux - demuxes an ogm stream into its component media streams ogmsplit - splits an ogm stream into chunks ogmmerge - joins media streams into an ogm stream dvdxchap - extracts chapter information from DVDs ogmtools-1.5/debian/dirs0000644000076400234220000000001007541400347014753 0ustar mosuvj00000000000000usr/bin ogmtools-1.5/debian/changelog0000644000076400234220000000530110037307254015746 0ustar mosuvj00000000000000ogmtools (1:1.4-1) unstable; urgency=low * new version. -- Moritz Bunkus Wed, 14 Apr 2004 21:18:38 +0200 ogmtools (1:1.3-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Mon, 5 Apr 2004 13:22:32 +0200 ogmtools (1:1.2-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Thu, 20 Nov 2003 23:49:12 +0100 ogmtools (1:1.1-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Tue, 28 Oct 2003 21:52:29 +0100 ogmtools (1:1.0.3-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Tue, 20 May 2003 09:08:04 +0200 ogmtools (1:1.0.2-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Mon, 5 May 2003 08:00:00 +0200 ogmtools (1:1.0.1-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Tue, 4 Mar 2003 14:33:03 +0100 ogmtools (1:1.0.0-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Sat, 1 Mar 2003 18:34:32 +0100 ogmtools (1:0.973-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Mon, 13 Jan 2003 20:49:29 +0100 ogmtools (1:0.972-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Fri, 3 Jan 2003 21:31:00 +0100 ogmtools (1:0.970-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Fri, 13 Dec 2002 16:09:26 +0100 ogmtools (1:0.960-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Wed, 13 Nov 2002 20:07:57 +0100 ogmtools (1:0.954-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Thu, 24 Oct 2002 17:05:30 +0200 ogmtools (1:0.951-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Tue, 1 Oct 2002 10:46:30 +0200 ogmtools (1:0.950-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Mon, 30 Sep 2002 12:46:59 +0200 ogmtools (1:0.931-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Tue, 17 Sep 2002 18:00:44 +0200 ogmtools (1:0.93-2) unstable; urgency=low * Removed libogg-dev from Build-Depends (abuse). * Added new epoch because 93 < 922. -- Nicolas Boos Tue, 17 Sep 2002 13:47:42 +0200 ogmtools (0.93-1) unstable; urgency=low * new upstream. -- Moritz Bunkus Mon, 16 Sep 2002 23:18:14 +0200 ogmtools (0.922-1) unstable; urgency=low * new upstream. -- Jason Lunz Mon, 16 Sep 2002 10:23:50 -0400 ogmtools (0.901-1) unstable; urgency=low * Initial Release. -- Marc Leeman Mon, 2 Sep 2002 10:25:46 +0200 ogmtools-1.5/debian/docs0000644000076400234220000000001407535666440014761 0ustar mosuvj00000000000000README TODO ogmtools-1.5/debian/copyright0000644000076400234220000000046607610615232016037 0ustar mosuvj00000000000000This package was debianized by Marc Leeman on Mon, 2 Sep 2002 10:25:46 +0200. It was downloaded from http://www.bunkus.org/videotools/ogmtools/ Upstream Author: Moritz Bunkus This proram is licensed under the GPL. See /usr/share/common-licenses/GPL for details. ogmtools-1.5/debian/rules0000755000076400234220000000451007541644050015161 0ustar mosuvj00000000000000#!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatibility version to use. export DH_COMPAT=3 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif config.status: configure dh_testdir # Add here commands to configure the package. ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info build: build-stamp build-stamp: config.status dh_testdir # Add here commands to compile the package. $(MAKE) #/usr/bin/docbook-to-man debian/ogmtools.sgml > ogmtools.1 touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. -$(MAKE) distclean -test -r /usr/share/misc/config.sub && \ cp -f /usr/share/misc/config.sub config.sub -test -r /usr/share/misc/config.guess && \ cp -f /usr/share/misc/config.guess config.guess dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/ogmtools. $(MAKE) install prefix=$(CURDIR)/debian/ogmtools/usr # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot # dh_installdebconf dh_installdocs dh_installexamples dh_installmenu # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_installinit dh_installcron dh_installman dh_installinfo # dh_undocumented ogmmerge.1 ogminfo.1 ogmdemux.1 ogmsplit.1 dh_installchangelogs ChangeLog dh_link dh_strip dh_compress dh_fixperms # dh_makeshlibs dh_installdeb # dh_perl dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install ogmtools-1.5/debian/README.Debian0000644000076400234220000000026407535666440016156 0ustar mosuvj00000000000000ogmtools for Debian ------------------- First release, still need to check platform dependent compilation -- Marc Leeman , Mon, 2 Sep 2002 10:25:46 +0200 ogmtools-1.5/ogmdemux.c0000644000076400234220000007103710012132430014635 0ustar mosuvj00000000000000/* ogminfo -- utility for extracting raw streams from an OGG media file Written by Moritz Bunkus Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include #include #include #include #include "ogmstreams.h" #include "common.h" #define BLOCK_SIZE 4096 #define ACVORBIS 0xffff #define ACPCM 0x0001 #define ACMP3 0x0055 #define ACAC3 0x2000 typedef struct stream_t { int serial; int fd; double sample_rate; int eos, comment; int sno; char stype; ogg_stream_state instate; struct stream_t *next; int acodec; struct wave_header wh; ogg_int64_t bwritten; ogg_stream_state outstate; int packetno; ogg_int64_t max_granulepos; avi_t *avi; int subnr; } stream_t; stream_t *first; int nastreams = 0, nvstreams = 0, ntstreams = 0, numstreams = 0; int xraw = 0; void add_stream(stream_t *ndmx) { stream_t *cur = first; if (first == NULL) { first = ndmx; first->next = NULL; } else { cur = first; while (cur->next != NULL) cur = cur->next; cur->next = ndmx; ndmx->next = NULL; } } stream_t *find_stream(int fserial) { stream_t *cur = first; while (cur != NULL) { if (cur->serial == fserial) break; cur = cur->next; } return cur; } #define NOAUDIO 0 #define NOVIDEO 1 #define NOTEXT 2 unsigned char *xaudio; unsigned char *xvideo; unsigned char *xtext; int no[3]; char *basename; int verbose = 0; double highest_ts = 0; void usage(char *fname) { fprintf(stdout, "Usage: %s [options] inname\n\n" " options:\n" " inname Use 'inname' as the source.\n" " -o, --output out Use 'outname' as the base for destination file names." "\n '-v1', '-v2', '-a1', '-t1'... will be appended to\n" " this name. Default: use 'inname'.\n" " -a, --astream n Extract specified audio stream. Can be used more\n" " than once. Default: extract all streams.\n" " -d, --vstream n Extract specified video stream. Can be used more\n" " than once. Default: extract all streams.\n" " -t, --tstream n Extract specified text stream. Can be used more\n" " than once. Default: extract all streams.\n" " -na, --noaudio Don't extract any audio streams.\n" " -nv, --novideo Don't extract any video streams.\n" " -nt, --notext Don't extract any text streams.\n" " Default: extract all streams.\n" " -r, --raw Extract the raw streams only.\n" " Default: extract to useful formats\n" " (AVI, WAV, OGG, SRT...).\n" " -v, --verbose Increase verbosity.\n" " -h, --help Show this help.\n" " -V, --version Show version number.\n", fname); } int extraction_requested(unsigned char *s, int stream, int type) { int i; if (no[type]) return 0; if (strlen((char *)s) == 0) return 1; for (i = 0; i < strlen((char *)s); i++) if (s[i] == stream) return 1; return 0; } void flush_pages(stream_t *stream, ogg_packet *op) { ogg_page page; int ih, ib; while (ogg_stream_flush(&stream->outstate, &page)) { ih = write(stream->fd, page.header, page.header_len); ib = write(stream->fd, page.body, page.body_len); if (verbose > 1) fprintf(stdout, "(%s) x/a%d: %d + %d written\n", __FILE__, stream->sno, ih, ib); } } void write_pages(stream_t *stream, ogg_packet *op) { ogg_page page; int ih, ib; while (ogg_stream_pageout(&stream->outstate, &page)) { ih = write(stream->fd, page.header, page.header_len); ib = write(stream->fd, page.body, page.body_len); if (verbose > 1) fprintf(stdout, "(%s) x/a%d: %d + %d written\n", __FILE__, stream->sno, ih, ib); } } void handle_packet(stream_t *stream, ogg_packet *pack, ogg_page *page) { int i, hdrlen, end; long long lenbytes; char *sub; char out[100]; ogg_int64_t pgp, sst; if (pack->e_o_s) { stream->eos = 1; pack->e_o_s = 1; } if (((double)pack->granulepos * 1000.0 / (double)stream->sample_rate) > highest_ts) highest_ts = (double)pack->granulepos * 1000.0 / (double)stream->sample_rate; switch (stream->stype) { case 'v': if (!extraction_requested(xvideo, stream->sno, NOVIDEO)) return; break; case 'a': if (!extraction_requested(xaudio, stream->sno, NOAUDIO)) return; break; case 't': if (!extraction_requested(xtext, stream->sno, NOTEXT)) return; break; } hdrlen = (*pack->packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*pack->packet & PACKET_LEN_BITS2) << 1; for (i = 0, lenbytes = 0; i < hdrlen; i++) { lenbytes = lenbytes << 8; lenbytes += *((unsigned char *)pack->packet + hdrlen - i); } switch (stream->stype) { case 'v': if (((*pack->packet & 3) == PACKET_TYPE_HEADER) || ((*pack->packet & 3) == PACKET_TYPE_COMMENT)) return; if (!xraw) i = AVI_write_frame(stream->avi, (char *)&pack->packet[hdrlen + 1], pack->bytes - 1 - hdrlen, (pack->packet[0] & PACKET_IS_SYNCPOINT) ? 1 : 0); else i = write(stream->fd, (char *)&pack->packet[hdrlen + 1], pack->bytes - 1 - hdrlen); if (verbose > 1) fprintf(stdout, "(%s) x/v%d: %d written\n", __FILE__, stream->sno, i); break; case 't': if (((*pack->packet & 3) == PACKET_TYPE_HEADER) || ((*pack->packet & 3) == PACKET_TYPE_COMMENT)) return; if (xraw) { i = write(stream->fd, (char *)&pack->packet[hdrlen + 1], pack->bytes - 1 - hdrlen); if (verbose > 1) fprintf(stdout, "(%s) x/t%d: %d written\n", __FILE__, stream->sno, i); return; } sub = (char *)&pack->packet[hdrlen + 1]; if ((strlen(sub) > 1) || ((strlen(sub) > 0) && (*sub != ' '))) { sst = (pack->granulepos / stream->sample_rate) * 1000; pgp = sst + lenbytes; sprintf(out, "%d\r\n%02d:%02d:%02d,%03d --> " \ "%02d:%02d:%02d,%03d\r\n", stream->subnr + 1, (int)(sst / 3600000), (int)(sst / 60000) % 60, (int)(sst / 1000) % 60, (int)(sst % 1000), (int)(pgp / 3600000), (int)(pgp / 60000) % 60, (int)(pgp / 1000) % 60, (int)(pgp % 1000)); i = write(stream->fd, out, strlen(out)); end = strlen(sub) - 1; while ((end >= 0) && ((sub[end] == '\n') || (sub[end] == '\r'))) { sub[end] = 0; end--; } i += write(stream->fd, sub, strlen(sub)); i += write(stream->fd, "\r\n\r\n", 4); stream->subnr++; if (verbose > 1) fprintf(stdout, "(%s) x/t%d: %d written\n", __FILE__, stream->sno, i); } break; case 'a': switch (stream->acodec) { case ACVORBIS: if (xraw) { if (stream->packetno == 0) i = write(stream->fd, (char *)pack->packet, pack->bytes); else i = write(stream->fd, (char *)&pack->packet[1], pack->bytes - 1); if (verbose > 1) fprintf(stdout, "(%s) x/a%d: %d written\n", __FILE__, stream->sno, i); return; } stream->max_granulepos = (pack->granulepos > stream->max_granulepos ? pack->granulepos : stream->max_granulepos); if ((stream->packetno == 0) || (stream->packetno == 2)) { ogg_stream_packetin(&stream->outstate, pack); flush_pages(stream, pack); } else { ogg_stream_packetin(&stream->outstate, pack); write_pages(stream, pack); } stream->packetno++; break; default: if (((*pack->packet & 3) == PACKET_TYPE_HEADER) || ((*pack->packet & 3) == PACKET_TYPE_COMMENT)) return; i = write(stream->fd, pack->packet + 1 + hdrlen, pack->bytes - 1 - hdrlen); stream->bwritten += i; if (verbose > 1) fprintf(stdout, "(%s) x/a%d: %d written\n", __FILE__, stream->sno, i); break; } break; } } void process_ogm(int fdin) { ogg_sync_state sync; ogg_page page; ogg_packet pack; vorbis_info vi; vorbis_comment vc; char *buf, *new_name; int nread, np, sno; int endofstream = 0; stream_t *stream; ogg_sync_init(&sync); while (1) { np = ogg_sync_pageseek(&sync, &page); if (np < 0) { fprintf(stderr, "(%s) ogg_sync_pageseek failed\n", __FILE__); return; } if (np == 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); if (!buf) { fprintf(stderr, "(%s) ogg_sync_buffer failed\n", __FILE__); return; } if ((nread = read(fdin, buf, BLOCK_SIZE)) <= 0) { if (verbose > 0) fprintf(stdout, "(%s) end of stream\n", __FILE__); return; } ogg_sync_wrote(&sync, nread); continue; } if (!ogg_page_bos(&page)) { break; } else { ogg_stream_state sstate; sno = ogg_page_serialno(&page); if (ogg_stream_init(&sstate, sno)) { fprintf(stderr, "(%s) ogg_stream_init failed\n", __FILE__); return; } ogg_stream_pagein(&sstate, &page); ogg_stream_packetout(&sstate, &pack); if ((pack.bytes >= 7) && ! strncmp(&pack.packet[1], "vorbis", 6)) { stream = (stream_t *)malloc(sizeof(stream_t)); if (stream == NULL) { fprintf(stderr, "malloc failed.\n"); exit(1); } memset(stream, 0, sizeof(stream_t)); if (verbose > 0) { vorbis_info_init(&vi); vorbis_comment_init(&vc); if (vorbis_synthesis_headerin(&vi, &vc, &pack) >= 0) { fprintf(stdout, "(%s) (a%d/%d) Vorbis audio (channels %d " \ "rate %ld)\n", __FILE__, nastreams + 1, numstreams + 1, vi.channels, vi.rate); stream->sample_rate = vi.rate; } else fprintf(stdout, "(%s) (a%d/%d) Vorbis audio stream indicated " \ "but no Vorbis stream header found.\n", __FILE__, nastreams + 1, numstreams + 1); } stream->serial = sno; stream->acodec = ACVORBIS; stream->sample_rate = -1; stream->sno = nastreams + 1; stream->stype = 'a'; memcpy(&stream->instate, &sstate, sizeof(sstate)); if (extraction_requested(xaudio, nastreams + 1, NOAUDIO)) { new_name = malloc(strlen(basename) + 20); if (!new_name) { fprintf(stderr, "(%s) Failed to allocate %d bytes.\n", __FILE__, strlen(basename) + 20); exit(1); } if (xraw) sprintf(new_name, "%s-a%d.raw", basename, nastreams + 1); else sprintf(new_name, "%s-a%d.ogg", basename, nastreams + 1); stream->fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (stream->fd == -1) { fprintf(stderr, "(%s) Failed to create \"%s\" (%d, %s).\n", __FILE__, new_name, errno, strerror(errno)); exit(1); } if (!xraw) ogg_stream_init(&stream->outstate, rand()); if (verbose > 0) fprintf(stdout, "(%s) Extracting a%d to \"%s\".\n", __FILE__, nastreams + 1, new_name); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->instate, &pack) == 1); free(new_name); } add_stream(stream); nastreams++; numstreams++; } else if ((pack.bytes >= 142) && !strncmp(&pack.packet[1],"Direct Show Samples embedded in " "Ogg", 35) ) { if ((*(int32_t*)(pack.packet+96) == 0x05589f80) && (pack.bytes >= 184)) { fprintf(stdout, "(%s) (v%d/%d) Found old video header. Not " \ "supported.\n", __FILE__, nvstreams + 1, numstreams + 1); } else if (*(int32_t*)pack.packet+96 == 0x05589F81) { fprintf(stdout, "(%s) (a%d/%d) Found old audio header. Not " \ "supported.\n", __FILE__, nastreams + 1, numstreams + 1); } else { if (verbose > 0) fprintf(stdout, "(%s) OGG stream %d has an old header with an " \ "unknown type.", __FILE__, numstreams + 1); } } else if (((*pack.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER) && (pack.bytes >= (int)(sizeof(old_stream_header) + 1))) { stream_header sth; copy_headers(&sth, (old_stream_header *)&pack.packet[1], pack.bytes); if (!strncmp(sth.streamtype, "video", 5)) { unsigned long codec; char ccodec[5]; strncpy(ccodec, sth.subtype, 4); ccodec[4] = 0; codec = (sth.subtype[0] << 24) + (sth.subtype[1] << 16) + (sth.subtype[2] << 8) + sth.subtype[3]; if (verbose > 0) fprintf(stdout, "(%s) (v%d/%d) fps: %.3f width height: %dx%d " \ "codec: %p (%s)\n", __FILE__, nvstreams + 1, numstreams + 1, (double)10000000 / (double)get_uint64(&sth.time_unit), get_uint32(&sth.sh.video.width), get_uint32(&sth.sh.video.height), (void *)codec, ccodec); stream = (stream_t *)malloc(sizeof(stream_t)); if (stream == NULL) { fprintf(stderr, "malloc failed.\n"); exit(1); } stream->stype = 'v'; stream->serial = sno; stream->sample_rate = (double)10000000 / (double)get_uint64(&sth.time_unit); stream->sno = nvstreams + 1; memcpy(&stream->instate, &sstate, sizeof(sstate)); if (extraction_requested(xvideo, nvstreams + 1, NOVIDEO)) { new_name = malloc(strlen(basename) + 20); if (!new_name) { fprintf(stderr, "(%s) Failed to allocate %d bytes.\n", __FILE__, strlen(basename) + 20); exit(1); } if (!xraw) { sprintf(new_name, "%s-v%d.avi", basename, nvstreams + 1); stream->avi = AVI_open_output_file(new_name); if (stream->avi == NULL) { fprintf(stderr, "(%s) Failed to create \"%s\" (%s).\n", __FILE__, new_name, AVI_strerror()); exit(1); } AVI_set_video(stream->avi, get_uint32(&sth.sh.video.width), get_uint32(&sth.sh.video.height), stream->sample_rate, ccodec); } else { sprintf(new_name, "%s-v%d.raw", basename, nvstreams + 1); stream->fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (stream->fd == -1) { fprintf(stderr, "(%s) Failed to create \"%s\" (%d, %s).\n", __FILE__, new_name, errno, strerror(errno)); exit(1); } } if (verbose > 0) fprintf(stdout, "(%s) Extracting v%d to \"%s\".\n", __FILE__, nvstreams + 1, new_name); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->instate, &pack) == 1); } add_stream(stream); nvstreams++; numstreams++; } else if (!strncmp(sth.streamtype, "audio", 5)) { int codec; char buf[5]; memcpy(buf, sth.subtype, 4); buf[4] = 0; codec = strtoul(buf, NULL, 16); if (verbose > 0) { fprintf(stdout, "(%s) (a%d/%d) codec: %d (0x%04x) (%s), bits per " "sample: %d channels: %hd samples per second: %lld", __FILE__, nastreams + 1, numstreams + 1, codec, codec, codec == ACPCM ? "PCM" : codec == 55 ? "MP3" : codec == ACMP3 ? "MP3" : codec == ACAC3 ? "AC3" : "unknown", get_uint16(&sth.bits_per_sample), get_uint16(&sth.sh.audio.channels), get_uint64(&sth.samples_per_unit)); fprintf(stdout, " avgbytespersec: %d blockalign: %hd\n", get_uint32(&sth.sh.audio.avgbytespersec), get_uint16(&sth.sh.audio.blockalign)); } stream = (stream_t *)malloc(sizeof(stream_t)); if (stream == NULL) { fprintf(stderr, "malloc failed.\n"); exit(1); } stream->sno = nastreams + 1; stream->stype = 'a'; stream->sample_rate = get_uint64(&sth.samples_per_unit) * get_uint16(&sth.sh.audio.channels); stream->serial = sno; stream->acodec = codec; strncpy(stream->wh.riff.id, "RIFF", 4); strncpy(stream->wh.riff.wave_id, "WAVE", 4); strncpy(stream->wh.format.id, "fmt ", 4); put_uint32(&stream->wh.format.len, 16); put_uint16(&stream->wh.common.wFormatTag, 1); put_uint16(&stream->wh.common.wChannels, get_uint16(&sth.sh.audio.channels)); put_uint32(&stream->wh.common.dwSamplesPerSec, get_uint64(&sth.samples_per_unit)); put_uint32(&stream->wh.common.dwAvgBytesPerSec, get_uint16(&sth.sh.audio.channels) * get_uint64(&sth.samples_per_unit) * get_uint16(&sth.bits_per_sample) / 8); put_uint16(&stream->wh.common.wBlockAlign, 4); put_uint16(&stream->wh.common.wBitsPerSample, get_uint16(&sth.bits_per_sample)); strncpy(stream->wh.data.id, "data", 4); memcpy(&stream->instate, &sstate, sizeof(sstate)); if (extraction_requested(xaudio, nastreams + 1, NOAUDIO)) { new_name = malloc(strlen(basename) + 30); if (!new_name) { fprintf(stderr, "(%s) Failed to allocate %d bytes.\n", __FILE__, strlen(basename) + 30); exit(1); } if (!xraw) sprintf(new_name, "%s-a%d.%s", basename, nastreams + 1, codec == ACPCM ? "wav" : codec == ACMP3 ? "mp3" : codec == ACAC3 ? "ac3" : "audio"); else sprintf(new_name, "%s-a%d.raw", basename, nastreams + 1); stream->fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (stream->fd == -1) { fprintf(stderr, "(%s) Failed to create \"%s\" (%d, %s).\n", __FILE__, new_name, errno, strerror(errno)); exit(1); } if ((codec == ACPCM) && !xraw) write(stream->fd, &stream->wh, sizeof(stream->wh)); if (verbose > 0) fprintf(stdout, "(%s) Extracting a%d to \"%s\".\n", __FILE__, nastreams + 1, new_name); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->instate, &pack) == 1); } add_stream(stream); nastreams++; numstreams++; } else if (!strncmp(sth.streamtype, "text", 4)) { if (verbose > 0) fprintf(stdout, "(%s) (t%d/%d) text/subtitle stream\n", __FILE__, ntstreams + 1, numstreams + 1); stream = (stream_t *)malloc(sizeof(stream_t)); if (stream == NULL) { fprintf(stderr, "malloc failed.\n"); exit(1); } stream->sno = ntstreams + 1; stream->stype = 't'; stream->sample_rate = (double)10000000 / (double)get_uint64(&sth.time_unit); stream->serial = sno; memcpy(&stream->instate, &sstate, sizeof(sstate)); if (extraction_requested(xtext, ntstreams + 1, NOTEXT)) { new_name = malloc(strlen(basename) + 20); if (!new_name) { fprintf(stderr, "(%s) Failed to allocate %d bytes.\n", __FILE__, strlen(basename) + 10); exit(1); } if (!xraw) sprintf(new_name, "%s-t%d.srt", basename, ntstreams + 1); else sprintf(new_name, "%s-t%d.raw", basename, ntstreams + 1); stream->fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (stream->fd == -1) { fprintf(stderr, "(%s) Failed to create \"%s\" (%d, %s).\n", __FILE__, new_name, errno, strerror(errno)); exit(1); } if (verbose > 0) fprintf(stdout, "(%s) Extracting t%d to \"%s\".\n", __FILE__, ntstreams + 1, new_name); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->instate, &pack) == 1); } add_stream(stream); ntstreams++; numstreams++; } else { fprintf(stdout, "(%s) (%d) found new header of unknown/" \ "unsupported type\n", __FILE__, numstreams + 1); } } else { fprintf(stdout, "(%s) OGG stream %d is of an unknown type " \ "(bad header?)\n", __FILE__, numstreams + 1); } } } endofstream = 0; while (!endofstream) { sno = ogg_page_serialno(&page); stream = find_stream(sno); if (stream == NULL) { if (verbose > 1) fprintf(stdout, "(%s) Encountered packet for an unknown serial " \ "%d !?\n", __FILE__, sno); } else { if (verbose > 1) fprintf(stdout, "(%s) %c%d: NEW PAGE\n", __FILE__, stream->stype, stream->sno); ogg_stream_pagein(&stream->instate, &page); while (ogg_stream_packetout(&stream->instate, &pack) == 1) handle_packet(stream, &pack, &page); } while (ogg_sync_pageseek(&sync, &page) <= 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); nread = read(fdin, buf, BLOCK_SIZE); if (nread <= 0) { stream = first; while (stream != NULL) { switch (stream->stype) { case 'v': if ((stream->avi != NULL) && !xraw) AVI_close(stream->avi); else if (stream->fd > 0) close(stream->fd); break; case 't': if (stream->fd > 0) close(stream->fd); break; case 'a': if ((stream->fd > 0) && !xraw) { switch (stream->acodec) { case ACVORBIS: if (!stream->eos) { pack.b_o_s = 0; pack.e_o_s = 1; pack.packet = NULL; pack.bytes = 0; pack.granulepos = stream->max_granulepos; pack.packetno = stream->packetno; ogg_stream_packetin(&stream->outstate, &pack); } flush_pages(stream, &pack); ogg_stream_clear(&stream->outstate); break; case ACPCM: put_uint32(&stream->wh.riff.len, stream->bwritten + sizeof(stream->wh) - 8); put_uint32(&stream->wh.data.len, stream->bwritten); lseek(stream->fd, 0, SEEK_SET); write(stream->fd, &stream->wh, sizeof(stream->wh)); break; } close(stream->fd); } else if (stream->fd > 0) close(stream->fd); break; } stream = stream->next; } if (verbose > 0) fprintf(stdout, "(%s) end of stream\n", __FILE__); endofstream = 1; break; } else ogg_sync_wrote(&sync, nread); } } } int main(int argc, char *argv[]) { int i, fdin = -1, stream, l; nice(2); xaudio = (char *)malloc(1); xvideo = (char *)malloc(1); xtext = (char *)malloc(1); *xaudio = 0; *xvideo = 0; *xtext = 0; basename = NULL; no[NOAUDIO] = 0; no[NOVIDEO] = 0; no[NOTEXT] = 0; for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { fprintf(stdout, "ogmdemux v" VERSION "\n"); exit(0); } for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) verbose++; else if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--output")) { if ((i + 1) == argc) { fprintf(stderr, "(%s) -o needs a file name.\n", __FILE__); return 1; } basename = argv[i + 1]; i++; } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { usage(argv[0]); exit(0); } else if (!strcmp(argv[i], "-a") || !strcmp(argv[i], "--astream")) { if ((i + 1) == argc) { fprintf(stderr, "(%s) -a needs a stream number.\n", __FILE__); return 1; } if (no[NOAUDIO]) { fprintf(stderr, "(%s) -na was already given - aborting.\n", __FILE__); return 1; } stream = strtol(argv[i + 1], NULL, 10); if ((stream < 1) || (stream > 255)) { fprintf(stderr, "(%s) Audio stream range is 1..255.\n", __FILE__); return 1; } l = strlen(xaudio); xaudio = realloc(xaudio, l + 2); xaudio[l] = (unsigned char)stream; xaudio[l + 1] = 0; i++; } else if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--vstream")) { if ((i + 1) == argc) { fprintf(stderr, "(%s) -d needs a stream number.\n", __FILE__); return 1; } if (no[NOVIDEO]) { fprintf(stderr, "(%s) -nd was already given - aborting.\n", __FILE__); return 1; } stream = strtol(argv[i + 1], NULL, 10); if ((stream < 1) || (stream > 255)) { fprintf(stderr, "(%s) Video stream range is 1..255.\n", __FILE__); return 1; } l = strlen(xvideo); xvideo = realloc(xvideo, l + 2); xvideo[l] = (unsigned char)stream; xvideo[l + 1] = 0; i++; } else if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--tstream")) { if ((i + 1) == argc) { fprintf(stderr, "(%s) -t needs a stream number.\n", __FILE__); return 1; } if (no[NOTEXT]) { fprintf(stderr, "(%s) -nt was already given - aborting.\n", __FILE__); return 1; } stream = strtol(argv[i + 1], NULL, 10); if ((stream < 1) || (stream > 255)) { fprintf(stderr, "(%s) Text stream range is 1..255.\n", __FILE__); return 1; } l = strlen(xtext); xtext = realloc(xtext, l + 2); xtext[l] = (unsigned char)stream; xtext[l + 1] = 0; i++; } else if (!strcmp(argv[i], "-na") || !strcmp(argv[i], "--noaudio")) no[NOAUDIO] = 1; else if (!strcmp(argv[i], "-nv") || !strcmp(argv[i], "--novideo")) no[NOVIDEO] = 1; else if (!strcmp(argv[i], "-nt") || !strcmp(argv[i], "--notext")) no[NOTEXT] = 1; else if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--raw")) xraw = 1; else if (fdin < 0) { fdin = open(argv[i], O_RDONLY); if (fdin == -1) { fprintf(stderr, "(%s) Could not open \"%s\".\'\n", __FILE__, argv[i]); return 1; } if (basename == NULL) basename = argv[i]; } else { fprintf(stderr, "(%s) More than one input file given. Aborting.\n", __FILE__); return 1; } } if (basename != NULL) { char *strp; strp = basename; while (*strp) { if (*strp == '/') basename = &strp[1]; strp++; } } if (fdin == -1) { usage(argv[0]); exit(1); } process_ogm(fdin); close(fdin); return 0; } ogmtools-1.5/ogmmerge.cpp0000644000076400234220000007753110037021763015174 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes ogmmerge.cpp main program, command line parameter checking, looping, output handling Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "r_ogm.h" #include "r_avi.h" #include "r_wav.h" #include "r_srt.h" #include "r_mp3.h" #include "r_ac3.h" #include "r_microdvd.h" #ifdef ENABLE_VOBSUB #include "r_vobsub.h" #endif // ENABLE_VOBSUB #ifdef ENABLE_INDEX #include "p_index.h" #endif // ENABLE_INDEX typedef struct { char *ext; int type; char *desc; } file_type_t; typedef struct filelist_tag { char *name; FILE *fp; int type; int status; ogmmerge_page_t *page; generic_reader_c *reader; struct filelist_tag *next; } filelist_t; char *outfile = NULL; FILE *out; filelist_t *input; int verbose; int force_flushing = 0; int omit_empty_packets = 0; int old_headers = 0; float video_fps = -1.0; #ifdef ENABLE_INDEX int create_index = 0; int idx_num = 0; int *idx_serials = NULL; int *idx_num_entries = NULL; idx_entry **idx_entries = NULL; index_packetizer_c **idx_packetizers = NULL; #endif // ENABLE_INDEX file_type_t file_types[] = {{"---", TYPEUNKNOWN, ""}, {"demultiplexers:", -1, ""}, {"ogg", TYPEOGM, "general OGG media stream, Vorbis audio embedded in OGG"}, {"avi", TYPEAVI, "AVI (Audio/Video Interleaved)"}, {"wav", TYPEWAV, "WAVE (uncompressed PCM)"}, {"srt", TYPEWAV, "SRT text subtitles"}, {" ", TYPEMICRODVD, "MicroDVD text subtitles"}, #ifdef ENABLE_VOBSUB {"idx", TYPEVOBSUB, "VobSub subtitles"}, #endif // ENABLE_VOBSUB {"mp3", TYPEMP3, "MPEG1 layer III audio (CBR and VBR/ABR)"}, {"ac3", TYPEAC3, "A/52 (aka AC3)"}, {"output modules:", -1, ""}, {" ", -1, "Vorbis audio"}, {" ", -1, "Video (not MPEG1/2)"}, {" ", -1, "uncompressed PCM audio"}, {" ", -1, "text subtitles"}, #ifdef ENABLE_VOBSUB {" ", -1, "VobSub subtitles"}, #endif // ENABLE_VOBSUB {" ", -1, "MP3 audio"}, {" ", -1, "AC3 audio"}, {NULL, -1, NULL}}; static void usage(void) { fprintf(stdout, "ogmmerge -o out [global options] [options] [[options] ...]" "\n\n Global options:\n" " -v, --verbose verbose status\n" " -q, --quiet suppress status output\n" " -o, --output out Write to the file 'out'.\n" #ifdef ENABLE_INDEX " -i, --index Create index for the video streams.\n" #endif // ENABLE_INDEX "\n Options for each input file:\n" " -a, --astreams Copy the n'th audio stream, NOT the stream with" "\n the serial number n. Default: copy all audio\n" " streams.\n" " -d, --vstreams Copy the n'th video stream, NOT the stream with" "\n the serial number n. Default: copy all video\n" " streams.\n" " -t, --tstreams Copy the n'th text stream, NOT the stream with" "\n the serial number n. Default: copy all text\n" " streams.\n" " -A, --noaudio Don't copy any audio stream from this file.\n" " -D, --novideo Don't copy any video stream from this file.\n" " -T, --notext Don't copy any text stream from this file.\n" " -s, --sync Synchronize, delay the audio stream by d ms.\n" " d > 0: Pad with silent samples.\n" " d < 0: Remove samples from the beginning.\n" " o/p: Adjust the timestamps by o/p to fix\n" " linear drifts. p defaults to 1000 if\n" " omitted. Both o and p can be floating point\n" " numbers.\n" " -r, --range Only process from start to end. Both values\n" " take the form 'HH:MM:SS.mmm' or 'SS.mmm',\n" " e.g. '00:01:00.500' or '60.500'. If one of\n" " s or e is omitted then it defaults to 0 or\n" " to end of the file respectively.\n" " -c, --comment 'A=B#C=D' Set additional comment fields for the\n" " streams. Sensitive values would be\n" " 'LANGUAGE=English' or 'TITLE=Ally McBeal'.\n" " -f, --fourcc Forces the FourCC to the specified value.\n" " Works only for video streams.\n" " --omit-empty-packets Omit the empty subtitle packets.\n" " --old-headers Assume OGM files have been created with\n" " an older version of ogmmerge ( < 1.1).\n" " --nav-seek Use an external AVI index file as generated by\n" " aviindex from transcode.\n" "\n" " Other options:\n" " -l, --list-types List supported input file types.\n" " -h, --help Show this help.\n" " -V, --version Show version information.\n" ); } static void set_defaults(void) { /* set defaults */ outfile = NULL; out = NULL; input = NULL; verbose = 1; } static int get_type(char *filename) { FILE *f = fopen(filename, "r"); off_t size; if (f == NULL) { fprintf(stderr, "Error: could not open source file (%s).\n", filename); exit(1); } if (fseeko(f, 0, SEEK_END) != 0) { fprintf(stderr, "Error: could not seek to end of file (%s).\n", filename); exit(1); } size = ftello(f); if (fseeko(f, 0, SEEK_SET) != 0) { fprintf(stderr, "Error: could not seek to beginning of file (%s).\n", filename); exit(1); } if (avi_reader_c::probe_file(f, size)) return TYPEAVI; else if (wav_reader_c::probe_file(f, size)) return TYPEWAV; else if (ogm_reader_c::probe_file(f, size)) return TYPEOGM; else if (srt_reader_c::probe_file(f, size)) return TYPESRT; else if (mp3_reader_c::probe_file(f, size)) return TYPEMP3; else if (ac3_reader_c::probe_file(f, size)) return TYPEAC3; else if (microdvd_reader_c::probe_file(f, size)) return TYPEMICRODVD; #ifdef ENABLE_VOBSUB else if (vobsub_reader_c::probe_file(f, size)) return TYPEVOBSUB; #endif // ENABLE_VOBSUB else if (chapter_information_probe(f, size)) return TYPECHAPTERS; else return TYPEUNKNOWN; } static void add_file(filelist_t *file) { filelist_t *temp; if (input == NULL) { input = file; } else { temp = input; while (temp->next) temp = temp->next; temp->next = file; } } int _serials = 0; int create_unique_serial() { _serials++; return _serials - 1; } static int display_counter = 1; void display_progress(int force) { filelist_t *winner, *current; if (((display_counter % 500) == 0) || force) { display_counter = 0; winner = input; current = winner->next; while (current) { if (current->reader->display_priority() > winner->reader->display_priority()) winner = current; current = current->next; } winner->reader->display_progress(); } display_counter++; } static unsigned char *parse_streams(char *s) { char *c = s; char *nstart; int n, nstreams; unsigned char *streams; nstart = NULL; streams = NULL; nstreams = 0; while (*c) { if ((*c >= '0') && (*c <= '9')) { if (nstart == NULL) nstart = c; } else if (*c == ',') { *c = 0; if (nstart != NULL) { n = atoi(nstart); if ((n <= 0) || (n > 255)) { fprintf(stderr, "Error: stream number out of range (1..255): %d\n", n); exit(1); } streams = (unsigned char *)realloc(streams, nstreams + 2); if (streams == NULL) die("malloc"); streams[nstreams] = (unsigned char)n; streams[nstreams + 1] = 0; nstart = NULL; nstreams++; } else fprintf(stderr, "Warning: useless use of ','\n"); } else if (!isspace(*c)) { fprintf(stderr, "Error: unrecognized character in stream list: '%c'\n", *c); exit(1); } c++; } if (nstart != NULL) { n = atoi(nstart); if ((n <= 0) || (n > 255)) { fprintf(stderr, "Error: stream number out of range (1..255): %d\n", n); exit(1); } streams = (unsigned char *)realloc(streams, nstreams + 2); if (streams == NULL) die("malloc"); streams[nstreams] = (unsigned char)n; streams[nstreams + 1] = 0; nstart = NULL; nstreams++; } return streams; } static void parse_sync(char *s, audio_sync_t *async) { char *linear, *div; double d1, d2; if ((linear = strchr(s, ',')) != NULL) { *linear = 0; linear++; div = strchr(linear, '/'); if (div == NULL) async->linear = strtod(linear, NULL) / 1000.0; else { *div = 0; div++; d1 = strtod(linear, NULL); d2 = strtod(div, NULL); if (d2 == 0.0) { fprintf(stderr, "Error: linear sync: division by zero?\n"); exit(1); } async->linear = d1 / d2; } if (async->linear <= 0.0) { fprintf(stderr, "Error: linear sync value may not be <= 0.\n"); exit(1); } } else async->linear = 1.0; async->displacement = atoi(s); } static double parse_time(char *s) { char *c, *a, *dot; int num_colons; double seconds; dot = strchr(s, '.'); if (dot != NULL) { *dot = 0; dot++; } for (c = s, num_colons = 0; *c; c++) { if (*c == ':') num_colons++; else if ((*c < '0') || (*c > '9')) { fprintf(stderr, "ERROR: illegal character '%c' in time range.\n", *c); exit(1); } } if (num_colons > 2) { fprintf(stderr, "ERROR: illegal time range: %s.\n", s); exit(1); } if (num_colons == 0) { seconds = strtod(s, NULL); if (dot != NULL) seconds += strtod(dot, NULL) / 1000.0; } for (a = s, c = s, seconds = 0; *c; c++) { if (*c == ':') { *c = 0; seconds *= 60; seconds += atoi(a); a = c + 1; } } seconds *= 60; seconds += atoi(a); if (dot != NULL) seconds += strtod(dot, NULL) / 1000.0; return seconds; } static void parse_range(char *s, range_t *range) { char *end; end = strchr(s, '-'); if (end != NULL) { *end = 0; end++; range->end = parse_time(end); } else range->end = 0; range->start = parse_time(s); if ((range->end != 0) && (range->end < range->start)) { fprintf(stderr, "ERROR: end time is set before start time.\n"); exit(1); } } static char **unpack_append_comments(char *line, char **comments) { char *hm, *s, *last; int nc, oc, i; if ((line == NULL) || (*line == 0)) return comments; for (hm = line, nc = 1; *hm; hm++) if (*hm == '#') nc++; oc = 0; if (comments == NULL) comments = (char **)malloc(sizeof(char *) * (nc + 1)); else { while (comments[oc] != NULL) oc++; comments = (char **)realloc(comments, sizeof(char *) * (oc + nc + 1)); } if (comments == NULL) die("malloc"); comments[oc + nc] = NULL; last = line; for (i = 0; (i < nc) && (last != NULL); i++) { s = strchr(last, '#'); if (s != NULL) { *s = 0; s++; } comments[oc + i] = strdup(last); if (comments[oc + i] == NULL) die("strdup"); last = s; } return comments; } static char **append_comments_from_file(char *filename, char **comments) { FILE *f; char line[1024]; int nc, i; if ((filename == NULL) || (filename[0] == 0) || (filename[1] == 0)) return NULL; if (filename[0] == '@') filename++; f = fopen(filename, "r"); if (f == NULL) { fprintf(stderr, "(%s) Error: Could not open '%s' for reading comments " "from it.\n", __FILE__, filename); exit(1); } nc = 0; if (comments != NULL) while (comments[nc] != NULL) nc++; fprintf(stderr, "(%s) Reading comments from '%s'...\n", __FILE__, filename); while (!feof(f)) { if (fgets(line, 1023, f) != NULL) { line[1023] = 0; i = strlen(line) - 1; while ((i >= 0) && ((line[i] == '\n') || (line[i] == '\r'))) { line[i] = 0; i--; } if (line[0] != 0) { comments = (char **)realloc(comments, sizeof(char *) * (nc + 2)); if (comments == NULL) die("realloc"); comments[nc] = strdup(line); if (comments[nc] == NULL) die("strdup"); nc++; comments[nc] = NULL; } } } fclose(f); return comments; } #ifdef DEBUG static void dump_comments(char **comments) { int i; for (i = 0; comments[i] != NULL; i++) fprintf(stderr, "comments[%d] = '%s'\n", i, comments[i]); } #endif // DEBUG static void parse_args(int argc, char **argv) { int i, j; int noaudio, novideo, notext; unsigned char *astreams, *vstreams, *tstreams; filelist_t *file; audio_sync_t async; range_t range; char **comments, *fourcc, *nav_seek; vorbis_comment *chapters; noaudio = 0; novideo = 0; notext = 0; astreams = NULL; vstreams = NULL; tstreams = NULL; memset(&range, 0, sizeof(range_t)); async.displacement = 0; async.linear = 1.0; comments = NULL; fourcc = NULL; nav_seek = NULL; chapters = NULL; for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { fprintf(stdout, "ogmmerge v" VERSION "\n"); exit(0); } #ifdef ENABLE_INDEX else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--index")) create_index = 1; #endif // ENABLE_INDEX for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-q")) verbose = 0; else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) verbose = 2; else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "--help")) { usage(); exit(0); } else if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--output")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -o lacks a file name.\n"); exit(1); } else if (outfile != NULL) { fprintf(stderr, "Error: only one output file allowed.\n"); exit(1); } outfile = (char *)strdup(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list-types")) { fprintf(stdout, "Known file types:\n" " ext description\n" " --- --------------------------\n"); for (j = 1; file_types[j].ext; j++) fprintf(stdout, " %s %s\n", file_types[j].ext, file_types[j].desc); exit(0); } else if (!strcmp(argv[i], "-A") || !strcmp(argv[i], "--noaudio")) noaudio = 1; else if (!strcmp(argv[i], "-D") || !strcmp(argv[i], "--novideo")) novideo = 1; else if (!strcmp(argv[i], "-T") || !strcmp(argv[i], "--notext")) notext = 1; else if (!strcmp(argv[i], "-a") || !strcmp(argv[i], "--astreams")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -a lacks the stream number(s).\n"); exit(1); } if (astreams != NULL) free(astreams); astreams = parse_streams(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--vstreams")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -d lacks the stream number(s).\n"); exit(1); } if (vstreams != NULL) free(vstreams); vstreams = parse_streams(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--tstreams")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -t lacks the stream number(s).\n"); exit(1); } if (tstreams != NULL) free(tstreams); tstreams = parse_streams(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--comments")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -c lacks the comments.\n"); exit(1); } if (argv[i + 1][0] == '@') comments = append_comments_from_file(argv[i + 1], comments); else comments = unpack_append_comments(argv[i + 1], comments); #ifdef DEBUG dump_comments(comments); #endif // DEBUG i++; } else if (!strcmp(argv[i], "-f") || !strcmp(argv[i], "--fourcc")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -f lacks the FourCC.\n"); exit(1); } fourcc = argv[i + 1]; if (strlen(fourcc) != 4) { fprintf(stderr, "Error: The FourCC must be exactly four chars long.\n"); exit(1); } i++; } else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--sync")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -s lacks the audio delay.\n"); exit(1); } parse_sync(argv[i + 1], &async); i++; } else if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--range")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: -r lacks the range.\n"); exit(1); } parse_range(argv[i + 1], &range); i++; } else if (!strcmp(argv[i], "--force-flushing")) { force_flushing = 1; fprintf(stdout, "WARNING: You're enabling flushing after each OGG packet.\n" " This will take more space and is generally a bad\n" " idea. It's intended for debugging purposes only.\n"); } else if (!strcmp(argv[i], "--omit-empty-packets")) omit_empty_packets = true; else if (!strcmp(argv[i], "--old-headers")) { old_headers = 1; } else if (!strcmp(argv[i], "--nav-seek")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: --nav-seek lacks the file name.\n"); exit(1); } nav_seek = argv[i+1]; i++; } #ifdef ENABLE_INDEX else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--index")) create_index = 1; #endif // ENABLE_INDEX else { if ((astreams != NULL) && noaudio) { fprintf(stderr, "Error: -A and -a used on the same source file.\n"); exit(1); } if ((vstreams != NULL) && novideo) { fprintf(stderr, "Error: -D and -d used on the same source file.\n"); exit(1); } if ((tstreams != NULL) && notext) { fprintf(stderr, "Error: -T and -t used on the same source file.\n"); exit(1); } if (noaudio) { astreams = (unsigned char *)malloc(1); if (astreams == NULL) die("malloc"); *astreams = 0; } if (novideo) { vstreams = (unsigned char *)malloc(1); if (vstreams == NULL) die("malloc"); *vstreams = 0; } if (notext) { tstreams = (unsigned char *)malloc(1); if (tstreams == NULL) die("malloc"); *tstreams = 0; } file = (filelist_t *)malloc(sizeof(filelist_t)); if (file == NULL) die("malloc"); file->name = argv[i]; file->type = get_type(file->name); if (file->type == TYPEUNKNOWN) { fprintf(stderr, "Error: File %s has unknown type. Please have a look " "at the supported file types ('ogmmerge --list-types') and " "contact me at moritz@bunkus.org if your file type is " "supported but not recognized properly.\n", file->name); exit(1); } file->fp = NULL; try { switch (file->type) { case TYPEOGM: file->reader = new ogm_reader_c(file->name, astreams, vstreams, tstreams, &async, &range, comments, fourcc); break; case TYPEAVI: if (tstreams != NULL) fprintf(stderr, "Warning: -t/-T are ignored for AVI files.\n"); file->reader = new avi_reader_c(file->name, astreams, vstreams, &async, &range, comments, fourcc, nav_seek); break; case TYPEWAV: if ((astreams != NULL) || (vstreams != NULL) || (tstreams != NULL)) fprintf(stderr, "Warning: -a/-A/-d/-D/-t/-T are ignored for " \ "WAVE files.\n"); file->reader = new wav_reader_c(file->name, &async, &range, comments); break; case TYPESRT: if ((astreams != NULL) || (vstreams != NULL) || (tstreams != NULL)) fprintf(stderr, "Warning: -a/-A/-d/-D/-t/-T are ignored for " \ "SRT files.\n"); file->reader = new srt_reader_c(file->name, &async, &range, comments); break; case TYPEMP3: if ((astreams != NULL) || (vstreams != NULL) || (tstreams != NULL)) fprintf(stderr, "Warning: -a/-A/-d/-D/-t/-T are ignored for " \ "MP3 files.\n"); file->reader = new mp3_reader_c(file->name, &async, &range, comments); break; case TYPEAC3: if ((astreams != NULL) || (vstreams != NULL) || (tstreams != NULL)) fprintf(stderr, "Warning: -a/-A/-d/-D/-t/-T are ignored for " \ "AC3 files.\n"); file->reader = new ac3_reader_c(file->name, &async, &range, comments); break; case TYPECHAPTERS: if (chapters != NULL) { fprintf(stderr, "Error: only one chapter file allowed.\n"); exit(1); } chapters = chapter_information_read(file->name); break; case TYPEMICRODVD: if ((astreams != NULL) || (vstreams != NULL) || (tstreams != NULL)) fprintf(stderr, "Warning: -a/-A/-d/-D/-t/-T are ignored for " \ "MicroDVD files.\n"); file->reader = new microdvd_reader_c(file->name, &async, &range, comments); break; #ifdef ENABLE_VOBSUB case TYPEVOBSUB: if ((astreams != NULL) || (vstreams != NULL) || (tstreams != NULL)) fprintf(stderr, "Warning: -a/-A/-d/-D/-t/-T are ignored for " \ "VobSub files.\n"); file->reader = new vobsub_reader_c(file->name, &async, &range, comments); break; #endif // ENABLE_VOBSUB default: fprintf(stderr, "EVIL internal bug! (unknown file type)\n"); exit(1); break; } } catch (error_c error) { fprintf(stderr, "Demultiplexer failed to initialize:\n%s\n", error.get_error()); exit(1); } if (file->type != TYPECHAPTERS) { file->status = EMOREDATA; file->next = NULL; file->page = NULL; add_file(file); } else free(file); free_comments(comments); comments = NULL; fourcc = NULL; noaudio = 0; novideo = 0; notext = 0; if (astreams != NULL) { free(astreams); astreams = NULL; } if (vstreams != NULL) { free(vstreams); vstreams = NULL; } if (tstreams != NULL) { free(tstreams); tstreams = NULL; } async.displacement = 0; async.linear = 1.0; memset(&range, 0, sizeof(range_t)); } } if (input == NULL) { usage(); exit(1); } if (outfile == NULL) { fprintf(stderr, "Error: no output files given.\n"); exit(1); } if (chapters != NULL) { file = input; while (file != NULL) { file->reader->set_chapter_info(chapters); file = file->next; } vorbis_comment_clear(chapters); free(chapters); chapters = NULL; } } #ifdef ENABLE_INDEX void add_index(int serial) { int i, found = -1; if (!create_index) return; for (i = 0; i < idx_num; i++) if (idx_serials[i] == serial) { found = i; break; } if (found == -1) { idx_serials = (int *)realloc(idx_serials, (idx_num + 1) * sizeof(int)); if (idx_serials == NULL) die("realloc"); idx_num_entries = (int *)realloc(idx_num_entries, (idx_num + 1) * sizeof(int)); if (idx_num_entries == NULL) die("realloc"); idx_packetizers = (index_packetizer_c **) realloc(idx_packetizers, (idx_num + 1) * sizeof(index_packetizer_c)); if (idx_packetizers == NULL) die("realloc"); idx_entries = (idx_entry **)realloc(idx_entries, (idx_num + 1) * sizeof(idx_entry)); if (idx_entries == NULL) die("realloc"); i = idx_num; idx_serials[i] = serial; idx_num_entries[i] = 0; idx_entries[i] = NULL; idx_num++; try { idx_packetizers[i] = new index_packetizer_c(serial); } catch (error_c error) { } } } void add_to_index(int serial, ogg_int64_t granulepos, off_t filepos) { int i, found = -1; for (i = 0; i < idx_num; i++) if (idx_serials[i] == serial) { found = i; break; } if (found == -1) { fprintf(stderr, "Internal error: add_to_index for a serial without " \ "add_index for that serial.\n"); exit(1); } idx_entries[i] = (idx_entry *)realloc(idx_entries[i], sizeof(idx_entry) * (idx_num_entries[i] + 1)); if (idx_entries[i] == NULL) die("realloc"); idx_entries[i][idx_num_entries[i]].granulepos = granulepos; idx_entries[i][idx_num_entries[i]].filepos = filepos; idx_num_entries[i]++; } #endif // ENABLE_INDEX int write_ogg_page(ogmmerge_page_t *mpage, char *s, filelist_t *file) { ogg_page *page; off_t bytes; page = mpage->og; if (verbose > 1) fprintf(stdout, "%f (timestamp) written %spage for %s\n", mpage->timestamp, s, (file != NULL) ? file->name : "an index"); bytes = fwrite(page->header, 1, page->header_len, out); if (bytes != page->header_len) { fprintf(stderr, "Error: Output error writing to %s: %d (%s).\n", outfile, errno, strerror(errno)); return 1; } bytes = fwrite(page->body, 1, page->body_len, out); if (bytes != page->body_len) { fprintf(stderr, "Error: Output error writing to %s: %d (%s).\n", outfile, errno, strerror(errno)); return 1; } free(page->header); free(page->body); free(page); free(mpage); return 0; } int main(int argc, char **argv) { filelist_t *file, *winner; int first_pages = 1; ogg_page *page; ogmmerge_page_t *mpage; int result; srand(time(NULL)); nice(2); set_defaults(); parse_args(argc, argv); /* open output file */ out = fopen(outfile, "w"); if (out == NULL) { fprintf(stderr, "Error: Couldn't open output file %s (%s).\n", outfile, strerror(errno)); exit(1); } /* let her rip! */ while (1) { /* Step 1: make sure an ogg page is available for each input ** as long we havne't already processed the last one */ file = input; while (file) { if (file->status == EMOREDATA) file->status = file->reader->read(); file = file->next; } /* Step 1.5: Write out the first page of each stream ** because headers must come together before any ** non-header pages. */ if (first_pages) { if (verbose >= 1) display_progress(1); first_pages = 0; file = input; while (file) { int header_page_produced = 0; while ((mpage = file->reader->get_header_page()) != NULL) { header_page_produced = 1; if ((result = write_ogg_page(mpage, "header ", file)) != 0) exit(result); } if (!header_page_produced) { fprintf(stderr, "Error: the reader for %s did not produce a " "header page.\n", file->name); exit(1); } file = file->next; } #ifdef ENABLE_INDEX if (create_index) for (i = 0; i < idx_num; i++) { mpage = idx_packetizers[i]->get_header_page(); if (mpage == NULL) { fprintf(stderr, "Error: one of the indexes did not produce a " "header page.\n"); exit(1); } if ((result = write_ogg_page(mpage, "header ", NULL)) != 0) exit(result); } #endif // ENABLE_INDEX file = input; while (file) { if (file->status == EMOREDATA) file->status = file->reader->read(); file = file->next; } file = input; while (file) { int comment_page_produced = 0; while ((mpage = file->reader->get_header_page(PACKET_TYPE_COMMENT)) != NULL) { comment_page_produced = 1; if ((result = write_ogg_page(mpage, "comment ", file)) != 0) exit(result); } if (!comment_page_produced) { fprintf(stderr, "Error: the reader for %s did not produce a " "comment page.\n", file->name); exit(1); } file = file->next; } #ifdef ENABLE_INDEX if (create_index) for (i = 0; i < idx_num; i++) { mpage = idx_packetizers[i]->get_header_page(PACKET_TYPE_COMMENT); if (mpage == NULL) { fprintf(stderr, "Error: one of the indexes did not produce a " "comment page.\n"); exit(1); } if ((result = write_ogg_page(mpage, "comment ", NULL)) != 0) exit(result); } #endif // ENABLE_INDEX continue; } file = input; while (file) { if (file->page == NULL) file->page = file->reader->get_page(); file = file->next; } /* Step 2: Pick the page with the lowest timestamp and ** stuff it into the ogg stream */ file = input; winner = file; file = file->next; while (file) { if (file->page != NULL) { if (winner->page == NULL) winner = file; else if (file->page && (file->page->timestamp < winner->page->timestamp)) winner = file; } file = file->next; } if (winner->page != NULL) mpage = winner->page; else /* exit if there are no more pages */ break; /* Step 3: Write out the winning page */ page = mpage->og; #ifdef ENABLE_INDEX if (create_index && (mpage->index_serial != -1)) add_to_index(mpage->index_serial, ogg_page_granulepos(page), ftello(out)); #endif // ENABLE_INDEX if ((result = write_ogg_page(mpage, "", winner)) != 0) exit(result); winner->page = NULL; /* display some progress information */ if (verbose == 1) display_progress(0); } if (verbose == 1) { display_progress(1); fprintf(stdout, "\n"); } file = input; while (file) { filelist_t *next = file->next; if (file->reader) delete file->reader; free(file); file = next; } #ifdef ENABLE_INDEX if (create_index) { for (i = 0; i < idx_num; i++) { fprintf(stdout, "serial %d num_entries %d size %d\n", idx_serials[i], idx_num_entries[i], idx_num_entries[i] * sizeof(idx_entry)); idx_packetizers[i]->process(&idx_entries[i][0], idx_num_entries[i]); while ((mpage = idx_packetizers[i]->get_page()) != NULL) if ((result = write_ogg_page(mpage, "", NULL)) != 0) exit(result); delete idx_packetizers[i]; } } #endif // ENABLE_INDEX fclose(out); return 0; } ogmtools-1.5/depcomp0000644000076400234220000002753307535666440014255 0ustar mosuvj00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. We will use -o /dev/null later, # however we can't do the remplacement now because # `-o $object' might simply not be used IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; -*) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 ogmtools-1.5/acinclude.m40000644000076400234220000002451507655160106015060 0ustar mosuvj00000000000000dnl PATH_AVILIB([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for avilib, and define AVILIB_CFLAGS and AVILIB_LIBS dnl AC_DEFUN(PATH_AVILIB, [dnl dnl Get the cflags and libraries dnl AVILIB_CFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_CXXFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_LIBS="-Lavilib -lavi" AC_SUBST(AVILIB_CFLAGS) AC_SUBST(AVILIB_CXXFLAGS) AC_SUBST(AVILIB_LIBS) ]) # Configure paths for libogg # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS dnl AC_DEFUN(XIPH_PATH_OGG, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(ogg-prefix,[ --with-ogg-prefix=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="") AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes) if test "x$ogg_prefix" != "x"; then ogg_args="$ogg_args --prefix=$ogg_prefix" OGG_CFLAGS="-I$ogg_prefix/include" OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE"; then ogg_args="$ogg_args --prefix=$prefix" OGG_CFLAGS="-I$prefix/include" OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" AC_MSG_CHECKING(for Ogg) no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" dnl dnl Now check if the installed Ogg is sufficiently new. dnl rm -f conf.oggtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(OGG_CFLAGS) AC_SUBST(OGG_LIBS) rm -f conf.oggtest ]) # Configure paths for libvorbis # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS dnl AC_DEFUN(XIPH_PATH_VORBIS, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(vorbis-prefix,[ --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="") AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes) if test "x$vorbis_prefix" != "x" ; then vorbis_args="$vorbis_args --prefix=$vorbis_prefix" VORBIS_CFLAGS="-I$vorbis_prefix/include" VORBIS_LIBDIR="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then vorbis_args="$vorbis_args --prefix=$prefix" VORBIS_CFLAGS="-I$prefix/include" VORBIS_LIBDIR="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" AC_MSG_CHECKING(for Vorbis) no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" dnl dnl Now check if the installed Vorbis is sufficiently new. dnl rm -f conf.vorbistest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(VORBIS_CFLAGS) AC_SUBST(VORBIS_LIBS) AC_SUBST(VORBISFILE_LIBS) AC_SUBST(VORBISENC_LIBS) rm -f conf.vorbistest ]) dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) dnl check if $CC supports a given set of cflags AC_DEFUN([AC_TRY_CFLAGS], [AC_MSG_CHECKING([if $CC supports $1 flags]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$1" AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no]) CFLAGS="$SAVE_CFLAGS" AC_MSG_RESULT([$ac_cv_try_cflags_ok]) if test x"$ac_cv_try_cflags_ok" = x"yes"; then ifelse([$2],[],[:],[$2]) else ifelse([$3],[],[:],[$3]) fi]) AC_DEFUN(PATH_DEBUG,[ AC_ARG_ENABLE([debug], [ --enable-debug compile with debug information]) if test x"$enable_debug" = x"yes"; then dnl debug information DEBUG_CFLAGS="-g -DDEBUG" else DEBUG_CFLAGS="" fi AC_SUBST(DEBUG_CFLAGS) ]) AC_DEFUN(PATH_PROFILING,[ AC_ARG_ENABLE([profiling], [ --enable-profiling compile with profiling information]) if test x"$enable_profiling" = x"yes"; then dnl profiling information PROFILING_CFLAGS="-pg" PROFILING_LIBS="-lc_p" else PROFILING_CFLAGS="" PROFILING_LIBS="" fi AC_SUBST(PROFILING_CFLAGS) AC_SUBST(PROFILING_LIBS) ]) dnl AM_PATH_LIBDVDREAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for LIBDVDREAD, and define LIBDVDREAD_CFLAGS and LIBDVDREAD_LIBS dnl AC_DEFUN(AM_PATH_LIBDVDREAD, [ AC_ARG_WITH(dvdread,[ --with-dvdread use installed libdvdread library (default=yes)],[case "${withval}" in yes) with_dvdread=yes;; no) with_dvdread=no ;; *) AC_MSG_ERROR(bad value ${withval} for --with-dvdread) ;; esac], with_dvdread=yes) AC_ARG_WITH(dvdread-includes,[ --with-dvdread-includes=PFX prefix where local dvdread includes are installed (optional)], dvdread_includes="$withval",dvdread_includes="") AC_ARG_WITH(dvdread-libs,[ --with-dvdread-libs=PFX prefix where local dvdread lib is installed (optional)], dvdread_libs="$withval", dvdread_libs="") DVDREAD_LIBS="" DVDREAD_CFLAGS="" have_dvdread=no if test x$with_dvdread = "x"yes ; then if test x$dvdread_includes != "x" ; then with_dvdread_i="$dvdread_includes/include" else with_dvdread_i="/usr/include" fi if test x$dvdread_libs != x ; then with_dvdread_l="$dvdread_libs/lib" else with_dvdread_l="/usr/lib" fi AC_CHECK_LIB(dvdread, DVDOpen, [DVDREAD_CFLAGS="-I$with_dvdread_i -I/usr/local/include" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread -lm" AC_DEFINE(HAVE_LIBDVDREAD) have_dvdread=yes], have_dvdread=no, -L$with_dvdread_l -ldvdread -lm) AC_CHECK_FILE($with_dvdread_i/dvdread/dvd_reader.h, [AC_DEFINE(HAVE_LIBDVDREAD_INC) dvdread_inc=yes]) if test x"$dvdread_inc" != xyes; then AC_CHECK_FILE(/usr/local/include/dvdread/dvd_reader.h, [AC_DEFINE(HAVE_LIBDVDREAD_INC) dvdread_inc=yes]) fi if test x"$have_dvdread" != "xyes"; then dnl use included lib with_dvdread_i="../dvdread" with_dvdread_l="../dvdread" AC_CHECK_FILE(./dvdread/dvd_reader.h, [AC_DEFINE(HAVE_LIBDVDREAD) have_dvdread=yes DVDREAD_CFLAGS="-I$with_dvdread_i" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread_tc"], have_dvdread=no) fi if test x"$have_dvdread" != "xyes"; then echo '***********************************' echo 'libdvdread not found. dvdxchap will' echo 'not be compiled.' echo '***********************************' fi fi AC_SUBST(DVDREAD_CFLAGS) AC_SUBST(DVDREAD_LIBS) ]) ogmtools-1.5/ogmcat.cpp0000644000076400234220000007520210141723145014634 0ustar mosuvj00000000000000/* ogmcat -- utility for concatenating OGG media files Written by Moritz Bunkus Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include #include #include #include #define OGMSPLIT #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "vorbis_header_utils.h" #define BLOCK_SIZE 4096 #define MAXSYNCMODE 4 #define DEFSYNCMODE 4 class cat_packetizer_c: public q_c { private: ogg_int64_t old_granulepos; char stype; double sample_rate; public: cat_packetizer_c(double nsample_rate, int nserial, char nstype); virtual ~cat_packetizer_c(); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void process(ogg_packet *op); virtual void produce_eos_packet() {}; virtual void produce_header_packets() {}; virtual void reset() {}; }; typedef struct stream_t { int serial; int eos, comment; char stype; ogg_stream_state instate; ogg_packet header_packet, header_packet2, header_packet3; stream_header sth; vorbis_info vi; ogg_int64_t last_granulepos, this_granulepos; ogg_int64_t granulepos, granuleposadd; ogg_int64_t packetno; ogg_int64_t num_frames, cur_frame; double sample_rate; vorbis_comment vc; int vc_unpacked; ogmmerge_page_t *mpage; cat_packetizer_c *pzr; struct stream_t *next; } stream_t; typedef struct source_t { char *name; int fd; off_t size; double manual_sync; stream_t *streams; source_t *next; } source_t; source_t *sources = NULL; int numstreams = 0; stream_t *vstream = NULL; ogg_int64_t bread = 0; ogg_int64_t bwritten = 0, bwritten_all = 0; FILE *fout; char *fout_name; int fout_num = 1; int verbose = 0; int frontend_mode = 0; int safety = 1; int sync_mode = DEFSYNCMODE; int last_percent = 0; /* * cat_packetizer class functions */ cat_packetizer_c::cat_packetizer_c(double nsample_rate, int nserial, char nstype) { old_granulepos = 0; stype = nstype; sample_rate = nsample_rate; serialno = nserial; ogg_stream_init(&os, serialno); } cat_packetizer_c::~cat_packetizer_c() { } stamp_t cat_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef XIPHCORRECTINTERLEAVING if (stype == 't') stamp = (stamp_t)((double)granulepos * (double)1000000.0 / sample_rate); else #endif stamp = (stamp_t)((double)old_granulepos * (double)1000000.0 / sample_rate); old_granulepos = granulepos; return stamp; } void cat_packetizer_c::process(ogg_packet *op) { ogg_stream_packetin(&os, op); queue_pages(); } /* * General helper functions, usage */ void usage(char *fname) { fprintf(stdout, "Usage: %s [options] -o out in1 [in2 [in3 ...]]\n\n" " options:\n" " in1, in2 ... Sources that will be concatenated.\n" " -m, --manualsync Additional sync in ms for the next input file.\n" " -o, --output out Use 'out' as the base name. This is mandatory.\n" " -s, --sync Uses sync mode . Valid values are 0..%d.\n" " Default is %d.\n" " -n, --nosafetychecks Disable all safety checks. This might produce\n" " broken and unplayable files.\n" /* " --frontend Enable frontend mode. Progress output will be\n" " terminated by \\n instead of \\r.\n"*/ " -v, --verbose Be verbose and show each OGG packet.\n" " Can be used twice to increase verbosity.\n" " -h, --help Show this help.\n" " -V, --version Show version information.\n", fname, MAXSYNCMODE, DEFSYNCMODE); } void print_progress(ogg_int64_t current, ogg_int64_t num, char *s) { if (frontend_mode) fprintf(stdout, "Processing %s %lld/%lld (%lld%%)\n", s, current, num, current * 100 / num); else fprintf(stdout, "Processing %s %lld/%lld (%lld%%)\r", s, current, num, current * 100 / num); fflush(stdout); } void copy_ogg_packet(ogg_packet *dst, ogg_packet *src) { memcpy(dst, src, sizeof(ogg_packet)); dst->packet = (unsigned char *)malloc(src->bytes); if (dst->packet == NULL) die("malloc"); memcpy(dst->packet, src->packet, src->bytes); } /* * File handling */ void write_page(ogg_page *page) { int ih, ib; if (fout == NULL) return; ih = fwrite(page->header, 1, page->header_len, fout); ib = fwrite(page->body, 1, page->body_len, fout); bwritten += ih + ib; bwritten_all += ih + ib; if (verbose > 1) fprintf(stdout, "(%s) %d + %d bytes written\n", __FILE__, ih, ib); } void flush_pages(stream_t *stream) { ogmmerge_page_t *mpage; ogg_page *page; stream->pzr->flush_pages(); if (stream->mpage == NULL) stream->mpage = stream->pzr->get_page(); while (stream->mpage != NULL) { mpage = stream->mpage; page = mpage->og; write_page(page); free(page->header); free(page->body); free(page); free(mpage); stream->mpage = stream->pzr->get_page(); } } int pages_available() { stream_t *stream; int eos_only; eos_only = 1; stream = sources->streams; while (stream != NULL) { if (stream->mpage != NULL) { stream = stream->next; eos_only = 0; continue; } if (stream->pzr->page_available()) { stream->mpage = stream->pzr->get_page(); stream = stream->next; eos_only = 0; continue; } if (!stream->eos) return 0; stream = stream->next; } return 1 - eos_only; } void write_winner_page() { stream_t *winner, *cur; winner = sources->streams; cur = winner->next; while (cur != NULL) { if (cur->mpage != NULL) { if (winner->mpage == NULL) winner = cur; else if (cur->mpage && (cur->mpage->timestamp < winner->mpage->timestamp)) winner = cur; } cur = cur->next; } if (winner->mpage != NULL) { write_page(winner->mpage->og); free(winner->mpage->og->header); free(winner->mpage->og->body); free(winner->mpage->og); free(winner->mpage); winner->mpage = NULL; } } void write_all_winner_pages() { while (pages_available()) write_winner_page(); } void flush_all_streams() { stream_t *s; s = sources->streams; while (s != NULL) { flush_pages(s); s = s->next; } } void produce_eos_packets() { stream_t *s; ogg_packet p; s = sources->streams; while (s != NULL) { if (!s->eos) { p.packet = (unsigned char *)""; p.bytes = 1; p.e_o_s = 1; p.b_o_s = 0; p.packetno = s->packetno++; p.granulepos = s->this_granulepos + (ogg_int64_t)s->granuleposadd; s->pzr->process(&p); s->eos = 1; } s = s->next; } write_all_winner_pages(); } void write_stream_headers() { stream_t *stream; stream = sources->streams; while (stream != NULL) { stream->pzr = new cat_packetizer_c(stream->sample_rate, stream->serial, stream->stype); stream->eos = 0; stream->granulepos = 0; stream->pzr->process(&stream->header_packet); flush_pages(stream); stream = stream->next; } } long get_queued_bytes() { long bytes; stream_t *stream; stream = sources->streams; bytes = 0; while (stream != NULL) { bytes += stream->pzr->get_queued_bytes(); stream = stream->next; } return bytes; } /* * stream and source adding and finding */ void add_stream(source_t *source, stream_t *ndmx) { stream_t *cur = source->streams; if (cur == NULL) { source->streams = ndmx; ndmx->next = NULL; } else { while (cur->next != NULL) cur = cur->next; cur->next = ndmx; ndmx->next = NULL; } } stream_t *find_stream(int fserial) { stream_t *cur = sources->streams; if ((cur != NULL) && (cur->next == NULL)) // Only one track. Let's just assume that the user wants to concatenate // Ogg audio files whose serial numbers are random. return cur; while (cur != NULL) { if (cur->serial == fserial) break; cur = cur->next; } return cur; } void add_source(char *name, int fd, off_t size, double manual_sync) { source_t *new_src, *cur; new_src = (source_t *)malloc(sizeof(source_t)); if (new_src == NULL) die("malloc"); memset(new_src, 0, sizeof(source_t)); new_src->name = strdup(name); if (new_src->name == NULL) die("strdup"); new_src->fd = fd; new_src->size = size; new_src->manual_sync = manual_sync; if (sources == NULL) sources = new_src; else { cur = sources; while (cur->next != NULL) cur = cur->next; cur->next = new_src; } } /* * all-mighty processing functions */ void probe_all_sources() { ogg_sync_state sync; ogg_page page; ogg_packet pack; vorbis_comment vc; source_t *src; stream_t *stream; char *buf; int np, res; long nread; src = sources; while (src != NULL) { fprintf(stdout, "(%s) Probing file '%s'...\n", __FILE__, src->name); ogg_sync_init(&sync); while (1) { np = ogg_sync_pageseek(&sync, &page); if (np < 0) { fprintf(stderr, "(%s) ogg_sync_pageseek failed for '%s'.\n", __FILE__, src->name); exit(1); } if (np == 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); if (!buf) { fprintf(stderr, "(%s) ogg_sync_buffer failed for '%s'.\n", __FILE__, src->name); exit(1); } if ((nread = read(src->fd, buf, BLOCK_SIZE)) <= 0) { fprintf(stderr, "(%s) File '%s' ended before the header packet " "was found. This file is broken.\n", __FILE__, src->name); exit(1); } ogg_sync_wrote(&sync, nread); bread += nread; continue; } if (!ogg_page_bos(&page)) break; stream = (stream_t *)malloc(sizeof(stream_t)); if (stream == NULL) die("malloc"); memset(stream, 0, sizeof(stream_t)); stream->serial = ogg_page_serialno(&page); if (ogg_stream_init(&stream->instate, stream->serial)) { fprintf(stderr, "(%s) ogg_stream_init failed\n", __FILE__); exit(1); } add_stream(src, stream); ogg_stream_pagein(&stream->instate, &page); ogg_stream_packetout(&stream->instate, &pack); copy_ogg_packet(&stream->header_packet, &pack); if ((pack.bytes >= 7) && !strncmp((char *)&pack.packet[1], "vorbis", 6)) { stream->stype = 'V'; vorbis_info_init(&stream->vi); vorbis_comment_init(&vc); if ((res = vorbis_synthesis_headerin(&stream->vi, &vc, &pack)) >= 0) stream->sample_rate = stream->vi.rate; else { fprintf(stderr, "(%s) Vorbis audio stream indicated " \ "but no Vorbis stream header found in '%s'. Error code was " "%d.\n", __FILE__, src->name, res); exit(1); } } else if (((*pack.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER) && (pack.bytes >= (int)(sizeof(stream_header) + 1))) { stream_header *sth = (stream_header *)(pack.packet + 1); if (!strncmp(sth->streamtype, "video", 5)) { stream->sample_rate = (double)10000000 / (double)get_uint64(&sth->time_unit); stream->stype = 'v'; if (vstream == NULL) vstream = stream; } else if (!strncmp(sth->streamtype, "audio", 5)) { stream->sample_rate = get_uint64(&sth->samples_per_unit); stream->stype = 'a'; } else if (!strncmp(sth->streamtype, "text", 4)) { stream->stype = 't'; stream->sample_rate = (double)10000000 / (double)get_uint64(&sth->time_unit); } else { fprintf(stderr, "(%s) Found new header of unknown/" \ "unsupported type in '%s'.\n", __FILE__, src->name); exit(1); } memcpy(&stream->sth, sth, sizeof(stream_header)); } else { fprintf(stderr, "(%s) Found unknown header in '%s'.\n", __FILE__, src->name); exit(1); } } ogg_sync_clear(&sync); lseek(src->fd, 0, SEEK_SET); src = src->next; } } void check_all_sources() { source_t *src; stream_t *stream, *str; char codec1[5], codec2[5]; double fps1, fps2; int num_not_matching, not_present; src = sources->next; while (src != NULL) { str = src->streams; if (str== NULL) { fprintf(stderr, "(%s) File '%s' does not contain any stream.\n", __FILE__, src->name); if (safety) exit(1); } num_not_matching = 0; while (str != NULL) { stream = find_stream(str->serial); not_present = 0; if (stream == NULL) not_present = 1; else if (str->serial != stream->serial) { num_not_matching++; if (num_not_matching > 1) not_present = 0; } if (not_present) { fprintf(stderr, "(%s) File '%s' contains a%s %s stream (serial %d) " "that is not present in '%s'.\n", __FILE__, src->name, str->stype == 'a' ? "n" : "", str->stype == 'V' ? "Vorbis" : str->stype == 'v' ? "video" : str->stype == 'a' ? "audio" : str->stype == 't' ? "text" : "unknown??", str->serial, sources->name); exit(1); } if (str->stype != stream->stype) { fprintf(stderr, "(%s) File '%s' contains a%s %s stream (serial %d) " "that is of another type (%s) in '%s'.\n", __FILE__, src->name, str->stype == 'a' ? "n" : "", str->stype == 'V' ? "Vorbis" : str->stype == 'v' ? "video" : str->stype == 'a' ? "audio" : str->stype == 't' ? "text" : "unknown??", str->serial, stream->stype == 'V' ? "Vorbis" : stream->stype == 'v' ? "video" : stream->stype == 'a' ? "audio" : stream->stype == 't' ? "text" : "unknown??", sources->name); if (safety) exit(1); } switch (str->stype) { case 'V': if (str->vi.rate != stream->vi.rate) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type Vorbis, rate %ld != %ld\n", __FILE__, sources->name, src->name, str->serial, str->vi.rate, stream->vi.rate); if (safety) exit(1); } if (str->vi.channels != stream->vi.channels) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type Vorbis, channels %d != %d\n", __FILE__, sources->name, src->name, str->serial, str->vi.channels, stream->vi.channels); if (safety) exit(1); } break; case 'v': codec1[4] = 0; codec2[4] = 0; memcpy(codec1, str->sth.subtype, 4); memcpy(codec2, stream->sth.subtype, 4); if (strcmp(codec1, codec2)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type video, codec %s != %s\n", __FILE__, sources->name, src->name, str->serial, codec1, codec2); if (safety) exit(1); } fps1 = (double)10000000 / (double)get_uint64(&str->sth.time_unit); fps2 = (double)10000000 / (double)get_uint64(&stream->sth.time_unit); if (fps1 != fps2) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type video, fps %.3f != %.3f\n", __FILE__, sources->name, src->name, str->serial, fps1, fps2); if (safety) exit(1); } if (get_uint32(&str->sth.sh.video.width) != get_uint32(&stream->sth.sh.video.width)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type video, width %d != %d\n", __FILE__, sources->name, src->name, str->serial, get_uint32(&str->sth.sh.video.width), get_uint32(&stream->sth.sh.video.width)); if (safety) exit(1); } if (get_uint32(&str->sth.sh.video.height) != get_uint32(&stream->sth.sh.video.height)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type video, height %d != %d\n", __FILE__, sources->name, src->name, str->serial, get_uint32(&str->sth.sh.video.height), get_uint32(&stream->sth.sh.video.height)); if (safety) exit(1); } break; case 'a': codec1[4] = 0; codec2[4] = 0; memcpy(codec1, str->sth.subtype, 4); memcpy(codec2, stream->sth.subtype, 4); if (strcmp(codec1, codec2)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type audio, codec %s != %s\n", __FILE__, sources->name, src->name, str->serial, codec1, codec2); if (safety) exit(1); } if (get_uint64(&str->sth.samples_per_unit) != get_uint64(&stream->sth.samples_per_unit)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type audio, samples per second %lld != " "%lld\n", __FILE__, sources->name, src->name, str->serial, get_uint64(&str->sth.samples_per_unit), get_uint64(&stream->sth.samples_per_unit)); if (safety) exit(1); } if (get_uint16(&str->sth.bits_per_sample) != get_uint16(&stream->sth.bits_per_sample)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type audio, bits per sample %d != %d\n", __FILE__, sources->name, src->name, str->serial, get_uint16(&str->sth.bits_per_sample), get_uint16(&stream->sth.bits_per_sample)); if (safety) exit(1); } if (get_uint16(&str->sth.sh.audio.channels) != get_uint16(&stream->sth.sh.audio.channels)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type audio, channels %d != %d\n", __FILE__, sources->name, src->name, str->serial, get_uint16(&str->sth.sh.audio.channels), get_uint16(&stream->sth.sh.audio.channels)); if (safety) exit(1); } break; case 't': if (get_uint64(&str->sth.time_unit) != get_uint64(&stream->sth.time_unit)) { fprintf(stderr, "(%s) Stream parameter mismatch for '%s' and '%s':" " serial %d, type text, time unit %lld != %lld\n", __FILE__, sources->name, src->name, str->serial, get_uint64(&str->sth.time_unit), get_uint64(&stream->sth.time_unit)); if (safety) exit(1); } break; default: fprintf(stderr, "(%s) Unsupported stream type in '%s'. This is a " "bug in ogmcat. Please report it to moritz@bunkus.org.\n", __FILE__, src->name); } str = str->next; } src = src->next; } } void process_ogms() { ogg_sync_state sync; ogg_page page; ogg_packet pack; int nread, np, sno, hdrlen, lenbytes, i; stream_t *stream; char *buf; source_t *src; double vtime2, vtime3, vtime4; ogg_int64_t manual_sync_granule; fout = fopen(fout_name, "w"); if (fout == NULL) { fprintf(stderr, "(%s) Could not open '%s' for writing.\n", __FILE__, fout_name); exit(1); } write_stream_headers(); src = sources; while (src != NULL) { fprintf(stdout, "(%s) Processing input file '%s'...\n", __FILE__, src->name); ogg_sync_init(&sync); while (1) { np = ogg_sync_pageseek(&sync, &page); if (np < 0) { fprintf(stderr, "(%s) ogg_sync_pageseek failed for '%s'.\n", __FILE__, src->name); exit(1); } if (np == 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); if (!buf) { fprintf(stderr, "(%s) ogg_sync_buffer failed for '%s'.\n", __FILE__, src->name); exit(1); } if ((nread = read(src->fd, buf, BLOCK_SIZE)) <= 0) break; ogg_sync_wrote(&sync, nread); bread += nread; continue; } sno = ogg_page_serialno(&page); stream = find_stream(sno); if (stream == NULL) fprintf(stdout, "(%s) Encountered page for the unknown serial " \ "%d. Skipping this page.\n", __FILE__, sno); else { ogg_stream_pagein(&stream->instate, &page); stream->last_granulepos = stream->this_granulepos; stream->this_granulepos = ogg_page_granulepos(&page); if (ogg_page_bos(&page)) { if (ogg_stream_init(&stream->instate, sno)) { fprintf(stderr, "(%s) ogg_stream_init failed\n", __FILE__); exit(1); } } else { while (ogg_stream_packetout(&stream->instate, &pack) == 1) { if (src == sources) { if (stream->stype != 'V') { if (stream->comment == 0) { copy_ogg_packet(&stream->header_packet2, &pack); if (stream->stype == 'v') { vorbis_unpack_comment(&stream->vc, (char *)pack.packet, pack.bytes); stream->vc_unpacked = 1; } stream->comment = 1; stream->packetno = 2; pack.packetno = 1; pack.granulepos = 0; stream->pzr->process(&pack); flush_pages(stream); continue; } } else { if (stream->comment == 0) { copy_ogg_packet(&stream->header_packet2, &pack); stream->comment = 1; pack.packetno = 1; pack.granulepos = 0; stream->pzr->process(&pack); continue; } else if (stream->comment == 1) { copy_ogg_packet(&stream->header_packet3, &pack); stream->comment = 2; stream->packetno = 3; pack.packetno = 2; pack.granulepos = 0; stream->pzr->process(&pack); flush_pages(stream); continue; } } } else if ((pack.packet[0] & PACKET_TYPE_HEADER ) == PACKET_TYPE_HEADER) continue; if (pack.e_o_s && (src->next == NULL)) stream->eos = 1; else if (pack.e_o_s && (src->next != NULL) && (pack.bytes <= 1)) continue; else pack.e_o_s = 0; if (pack.granulepos == -1) pack.granulepos = stream->this_granulepos; if (stream->stype == 'v') { if (pack.packet[0] & PACKET_IS_SYNCPOINT) stream->pzr->flush_pages(); hdrlen = (*pack.packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*pack.packet & PACKET_LEN_BITS2) << 1; lenbytes = 1; if ((hdrlen > 0) && (pack.bytes >= (hdrlen + 1))) for (i = 0, lenbytes = 0; i < hdrlen; i++) { lenbytes = lenbytes << 8; lenbytes += *((unsigned char *)pack.packet + hdrlen - i); } pack.granulepos = stream->granulepos + lenbytes - 1; if (lenbytes != 1) fprintf(stdout, "len: %d at pno %lld p0 %d\n", lenbytes, stream->packetno, (int)pack.packet[0]); stream->granulepos += lenbytes; } else pack.granulepos += (ogg_int64_t)stream->granuleposadd; pack.packetno = stream->packetno++; stream->pzr->process(&pack); if (stream->stype == 't') stream->pzr->flush_pages(); } } } write_all_winner_pages(); } if (src->next != NULL) { stream = sources->streams; if (vstream != NULL) { vtime2 = (double)(vstream->granulepos + 1) * 1000.0 / vstream->sample_rate; vtime3 = (double)(vstream->granulepos) * 1000.0 / vstream->sample_rate; vtime4 = (double)(vstream->granulepos - 1) * 1000.0 / vstream->sample_rate; } while (stream != NULL) { if ((sync_mode == 0) || (vstream == NULL)) stream->granuleposadd += stream->this_granulepos; else if (sync_mode == 1) stream->granuleposadd += stream->last_granulepos; else if (stream->stype != 'v') { if (sync_mode == 2) stream->granuleposadd = (ogg_int64_t)(vtime2 * stream->sample_rate / 1000.0); else if (sync_mode == 3) stream->granuleposadd = (ogg_int64_t)(vtime3 * stream->sample_rate / 1000.0); else if (sync_mode == 4) stream->granuleposadd = (ogg_int64_t)(vtime4 * stream->sample_rate / 1000.0); else { fprintf(stderr, "(%s) Internal error: unknown sync_mode %d. " "Please contact me at moritz@bunkus.org please.\n", __FILE__, sync_mode); exit(1); } } manual_sync_granule = (ogg_int64_t)(src->next->manual_sync * 1000.0 / stream->sample_rate); stream->granuleposadd += manual_sync_granule; if (verbose) { fprintf(stdout, "Stream %d, type %s, current granulepos %lld", stream->serial, stream->stype == 'v' ? "video" : stream->stype == 'V' ? "Vorbis" : stream->stype == 'a' ? "audio" : stream->stype == 't' ? "text" : "unknown", stream->this_granulepos); if (stream->stype != 'v') fprintf(stdout, ", granulepos offset %lld (including manual sync " "%lld)", stream->granuleposadd, manual_sync_granule); fprintf(stdout, "\n"); } stream = stream->next; } } src = src->next; } produce_eos_packets(); stream = sources->streams; while (stream != NULL) { delete(stream->pzr); stream->mpage = NULL; stream = stream->next; } ogg_sync_clear(&sync); fclose(fout); } int main(int argc, char *argv[]) { int i, fdin = -1; off_t file_size; double manual_sync; fprintf(stdout, "This program is not finished. It will probably not " "work for your files. It might work for files created with " "ogmsplit. It might not. Please do not ask me when it will " "be ready - I simply don't know. If you want to experiment " "with it then go ahead.\n"); for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { fprintf(stdout, "ogmsplit v" VERSION "\n"); exit(0); } manual_sync = 0.0; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) verbose++; else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { usage(argv[0]); return 0; } else if (!strcmp(argv[i], "--frontend")) frontend_mode = 1; else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--nosafetychecks")) safety = 0; else if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--output")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -o requires an argument.\n", __FILE__); exit(1); } fout_name = argv[i + 1]; i++; } else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--sync")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -s requires an argument.\n", __FILE__); exit(1); } sync_mode = strtol(argv[i + 1], NULL, 10); if ((sync_mode < 0) || (sync_mode > MAXSYNCMODE)) { fprintf(stderr, "(%s) Invalid sync mode %d. Valid values are 0..%d\n.", __FILE__, sync_mode, MAXSYNCMODE); exit(1); } i++; } else if (!strcmp(argv[i], "-m") || !strcmp(argv[i], "--manualsync")) { if ((i + 1) > argc) { fprintf(stderr, "(%s) -m requires an argument.\n", __FILE__); exit(1); } manual_sync = strtod(argv[i + 1], NULL); i++; } else { fdin = open(argv[i], O_RDONLY); if (fdin == -1) { fprintf(stderr, "(%s) Could not open \"%s\".\n", __FILE__, argv[i]); return 1; } file_size = lseek(fdin, 0, SEEK_END); if (file_size == (off_t)-1) { fprintf(stderr, "(%s) Could not seek to end of file.\n", __FILE__); return 1; } lseek(fdin, 0, SEEK_SET); add_source(argv[i], fdin, file_size, manual_sync); manual_sync = 0.0; } } if ((sources == NULL) || (sources->next == NULL)) { fprintf(stdout, "(%s) Not enough source files given.\n", __FILE__); usage(argv[0]); exit(1); } if (fout_name == NULL) { fprintf(stdout, "(%s) No output file name given.\n", __FILE__); usage(argv[0]); exit(1); } probe_all_sources(); check_all_sources(); if ((sync_mode == 1) && (vstream == 0)) { fprintf(stdout, "(%s) Sync mode 1 only works if the source files contain " "at least one video stream.\n", __FILE__); exit(1); } process_ogms(); return 0; } ogmtools-1.5/ogminfo.10000644000076400234220000000507610143371176014405 0ustar mosuvj00000000000000.TH OGMINFO "1" "November 2004" "ogminfo v1.5" "User Commands" .SH NAME ogminfo \- Print information about streams in OGG/OGM files .SH SYNOPSIS .B ogminfo [\fIoptions\fR] \fIinname\fR .SH DESCRIPTION .LP This program lists all streams contained in an OGM including information about the codecs used. .TP inname Use '\fIinname\fR' as the source. .TP \fB\-v\fR, \fB\-\-verbose\fR Be verbose and show each OGG packet. See the section '\fBVERBOSITY LEVELS\fR' for details. .TP \fB\-s\fR, \fB\-\-summary\fR Will print a short summary for each stream including the total size in bytes, the bitrate, the number of packets/frames and the length in seconds. This requires the parsing of the complete file. .TP \fB\-h\fR, \fB\-\-help\fR Show usage information. .TP \fB\-V\fR, \fB\-\-version\fR Show version information. .SH VERBOSITY LEVELS .LP The \fB-v\fR option can be used to increase \fBogminfo\fR's verbosity level and print more information about the current file. .TP level 0 will print only the streams it finds and their types. .TP level 1 will also print each stream's header and comment packets' contents. These two modes will not process the whole file (as opposed to all other modes) if the comment packets are placed correctly. .TP level 2 will print a line for each OGG packet it encounters containing the stream the packet belongs to, the payload size, the packet's granulepos, the packet's number, its start time, its end time and several flags. The flags may include 'sync_ok' or 'OUT_OF_SYNC' which indicates whether the packet's placement in the file is correct according to its granulepos. Other flags are 'IS_SYNCPOINT' or 'EOS'. .br level 2 and above automatically imply \fB\-\-summary\fR. .TP level 3 also prints a line whenever a new OGG page was read completely along with the page's exact position in the file it was read from. .TP level 4 will dump the complete stream_header structure found in the header packet for any non-Vorbis stream. .LP The levels 3 and 4 are intended for debugging purposes only. .LP .SH NOTES What works: .TP * OGM with Vorbis audio, 'normal' video (like DivX etc.), audio streams (PCM, MP3 etc.), text streams (subtitles). .LP What not works: .TP * Headers created by older OggDS (DirectShow) filter versions are not supported (and probably never will be). .SH AUTHOR .I ogminfo was written by Moritz Bunkus . .SH SEE ALSO .BR ogmmerge (1), .BR ogmsplit (1), .BR ogmdemux (1), .BR ogmcat (1), .BR dvdxchap (1) .SH WWW The newest version can always be found at .UR http://www.bunkus.org/videotools/ogmtools/ .UE ogmtools-1.5/r_wav.cpp0000644000076400234220000001055207655160106014505 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_wav.cpp WAVE demultiplexer module (supports raw / uncompressed PCM audio only, type 0x0001) Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include extern "C" { #include // for wave_header } #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_wav.h" int wav_reader_c::probe_file(FILE *file, off_t size) { wave_header wheader; if (size < sizeof(wave_header)) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fread((char *)&wheader, 1, sizeof(wheader), file) != sizeof(wheader)) { fseeko(file, 0, SEEK_SET); return 0; } fseeko(file, 0, SEEK_SET); if (strncmp((char *)wheader.riff.id, "RIFF", 4) || strncmp((char *)wheader.riff.wave_id, "WAVE", 4) || strncmp((char *)wheader.data.id, "data", 4)) return 0; return 1; } wav_reader_c::wav_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) { uint64_t size; uint32_t samplerate; uint16_t channels, bitdepth; if ((file = fopen(fname, "r")) == NULL) throw error_c("wav_reader: Could not open source file."); if (fseeko(file, 0, SEEK_END) != 0) throw error_c("wav_reader: Could not seek to end of file."); size = ftello(file); if (fseeko(file, 0, SEEK_SET) != 0) throw error_c("wav_reader: Could not seek to beginning of file."); if (!wav_reader_c::probe_file(file, size)) throw error_c("wav_reader: Source is not a valid WAVE file."); if (fread(&wheader, 1, sizeof(wheader), file) != sizeof(wheader)) throw error_c("wav_reader: could not read WAVE header."); bps = get_uint16(&wheader.common.wChannels) * get_uint16(&wheader.common.wBitsPerSample) * get_uint32(&wheader.common.dwSamplesPerSec) / 8; chunk = (unsigned char *)malloc(bps + 1); if (chunk == NULL) die("malloc"); bytes_processed = 0; samplerate = get_uint32(&wheader.common.dwSamplesPerSec); channels = get_uint16(&wheader.common.wChannels); bitdepth = get_uint16(&wheader.common.wBitsPerSample); pcmpacketizer = new pcm_packetizer_c(samplerate, channels, bitdepth, nasync, nrange, ncomments); if (verbose) fprintf(stderr, "Using WAV demultiplexer for %s.\n+-> Using " \ "PCM output module for audio stream.\n", fname); } wav_reader_c::~wav_reader_c() { if (file != NULL) fclose(file); if (chunk != NULL) free(chunk); if (pcmpacketizer != NULL) delete pcmpacketizer; } int wav_reader_c::read() { int nread, last_frame; if (pcmpacketizer->page_available()) return EMOREDATA; nread = fread(chunk, 1, bps, file); if (nread <= 0) { /* * In case that the WAVE header is not set correctly or any other error * occurs. The 'normal' end-of-stream should be handled by comparing the * number of bytes read to the WAVE header fields. */ *chunk = 0; pcmpacketizer->process((char *)chunk, 1, 1); pcmpacketizer->flush_pages(); return 0; } last_frame = 0; if ((bytes_processed + nread) >= (get_uint32(&wheader.riff.len) - sizeof(wave_header) + 8)) last_frame = 1; pcmpacketizer->process((char *)chunk, nread, last_frame); bytes_processed += nread; if (last_frame) return 0; else return EMOREDATA; } int wav_reader_c::serial_in_use(int serial) { return pcmpacketizer->serial_in_use(serial); } ogmmerge_page_t *wav_reader_c::get_header_page(int header_type) { return pcmpacketizer->get_header_page(header_type); } ogmmerge_page_t *wav_reader_c::get_page() { return pcmpacketizer->get_page(); } int wav_reader_c::display_priority() { return DISPLAYPRIORITY_HIGH - 1; } void wav_reader_c::reset() { if (pcmpacketizer != NULL) pcmpacketizer->reset(); } void wav_reader_c::display_progress() { int samples = (get_uint32(&wheader.riff.len) - sizeof(wheader) + 8) / bps; fprintf(stdout, "progress: %d/%d seconds (%d%%)\r", (int)(bytes_processed / bps), (int)samples, (int)(bytes_processed * 100L / bps / samples)); fflush(stdout); } ogmtools-1.5/avilib/0000755000076400234220000000000010143371303014113 5ustar mosuvj00000000000000ogmtools-1.5/avilib/xio.c0000644000076400234220000000416410141724010015056 0ustar mosuvj00000000000000/* * libxio.c * * Copyright (C) Lukas Hejtmanek - January 2004 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include #include #include int xio_open(const char *pathname, int flags, ...) { int mode=0; if(flags & O_CREAT) { va_list arg; va_start (arg, flags); mode = va_arg (arg, int); va_end (arg); } return open(pathname, flags, mode); } ssize_t xio_read(int fd, void *buf, size_t count) { return read(fd, buf, count); } ssize_t xio_write(int fd, const void *buf, size_t count) { return write(fd, buf, count); } int xio_ftruncate(int fd, off_t length) { #if defined(SYS_WINDOWS) _chsize(fd, length); #else return ftruncate(fd, length); #endif } off_t xio_lseek(int fd, off_t offset, int whence) { return lseek(fd, offset, whence); } int xio_close(int fd) { return close(fd); } int xio_stat(const char *file_name, struct stat *buf) { return stat(file_name, buf); } int xio_lstat(const char *file_name, struct stat *buf) { #if defined(SYS_WINDOWS) fprintf(stderr, "xio_lstat not implemented on Windows.\n"); exit(1); return -1; #else return lstat(file_name, buf); #endif } int xio_rename(const char *oldpath, const char *newpath) { return rename(oldpath, newpath); } int xio_fstat(int fd, struct stat *buf) { return fstat(fd, buf); } ogmtools-1.5/avilib/README.avilib0000644000076400234220000001523507527461677016300 0ustar mosuvj00000000000000avilib: Reading and writing avi files ===================================== Copyright (C) 1999 Rainer Johanni avilib is a open source library for dealing with AVI files under Linux or other UNIX operating systems. It provides a framework for extracting or adding raw audio and single raw (=compressed) frames from/to AVI Files. It does not deal with any compression issues which have to be handled on a higher level by the user of avilib. AVI files may have several video and audiotracks. avilib writes only one video track and (optionally) one audio track and also extracts only the first video and audio track (but input files may contain more than one track, the others just being ingored). The interface to avilib is kept similar to the quicktime4linux interface (by Adam Williams) with the following important differences: - since only the first track of video and audio is considered, there is no track argument in any of the routines. - audio is generally considered as a byte stream and therefore all size arguments used in reading/writing audio are in bytes and not in samples. - as mentioned above, there are no routines dealing with compression issues. Compiling: ========== Since the library consists only of one c source file, I have not provided a Makefile or similar, just compile with cc -c avilib.c Portability: ============ AVI-Files use little endian numbers throughout the file, I have tried to read/write these numbers in a way which doesn't depent on endianness. This library should therefore also be useable on big endian machines. This feature is not so heavily tested, however. Usage: ====== Basics, opening, closing ------------------------ Include "avilib.h" in your source and declare a pointer: avi_t *avifile; Open the AVI file with: avifile = AVI_open_input_file("xxx.avi",1); or avifile = AVI_open_output_file("xxx.avi"); You may either only read from the input file (leaving it unchanged) or create a completly new AVI file. There is no editing or append mode available. Both routines will either return a pointer to avi_t or a zero pointer in the case of an error. For closing the file, use: int AVI_close(avi_t *AVI); Files you have written MUST be closed (the header is written at close time), else they will not be readable by any other software. Files opened for reading should be closed to free the file descriptor and some data (unless your program is finishing anyway). Error handling: --------------- Most routines (besides open/close) will return 0 or a usefull number if successfull and a -1 in the case of an error. If an error occured, the external variable AVI_errno is set. See avilib.h for the meaning of the error codes in AVI_errno. There is also a routine (which acts like perror) to output a description of the last error to stderr: AVI_print_error(char *str) Reading from an AVI file: ------------------------- After opening the file, you can obtain the parameters of the AVI with the following routines: long AVI_video_frames(avi_t *AVI); number of video frames in the file int AVI_video_width(avi_t *AVI); int AVI_video_height(avi_t *AVI); width and height of the video in pixels double AVI_frame_rate(avi_t *AVI); frame rate in frames per second, notice that this is a double value! char* AVI_video_compressor(avi_t *AVI); string describing the compressor int AVI_audio_channels(avi_t *AVI); number of audio channels, 1 for mono, 2 for stereo, 0 if no audio present int AVI_audio_bits(avi_t *AVI); audio bits, usually 8 or 16 int AVI_audio_format(avi_t *AVI); audio format, most common is 1 for raw PCM, look into avilib.h for others long AVI_audio_rate(avi_t *AVI); audio rate in samples/second long AVI_audio_bytes(avi_t *AVI); total number of audio bytes in the file In order to read the video frame by frame, use (frame numbers are starting from 0 !!!!!) long AVI_frame_size(avi_t *AVI, long frame); to get the size of frame with number "frame" long AVI_read_frame(avi_t *AVI, char *vidbuf); to read the next frame (frame posittion is advanced by 1 after the read) int AVI_seek_start(avi_t *AVI); int AVI_set_video_position(avi_t *AVI, long frame); to position in the AVI file (for reading the frames out of order) Read audio with int AVI_set_audio_position(avi_t *AVI, long byte); to position to an arbitrary byte position within the audio stream long AVI_read_audio(avi_t *AVI, char *audbuf, long bytes); to actually read "bytes" number of audio bytes. the audio position is advanced by "bytes", so there is no need to reposition before every call when reading in order. Avoiding lengthy index searches: -------------------------------- When opening the AVI file, avilib looks if the file has an index attached and if this is not the case, it creates one by reading through the whole file. If you want to read through the file only once, creation of an index is not necessary in that case. You may use AVI_open_input_file with the second argument set to 0 and then use AVI_read_data for readin through the file. Look to the source for the arguments of AVI_read_data. Writing to an AVI file: ----------------------- After you have opened the file, use the following routines to set the properties of the AVI file: void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compressor); void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format); with: width, height width and height of the video in pixels fps frame rate in frames per second, notice that this is a double value! compressor string describing the compressor channels number of audio channels, 1 for mono, 2 for stereo, 0 if no audio present rate audio rate in samples/second bits audio bits, usually 8 or 16, 0 if no audio present format audio format, most common is 1 for raw PCM, look into avilib.h for others to write video frames or audio, use: int AVI_write_frame(avi_t *AVI, char *data, long bytes); int AVI_write_audio(avi_t *AVI, char *data, long bytes); there is also a feature to duplicate the index entry of the last frame without writing the data again to the file, this should used with care since I don't know if all AVI players can handle the resulting file (xanim can do it!): int AVI_dup_frame(avi_t *AVI); AVI files have a 2 GB limit (as has the Linux ext2 file system), avilib will return an error if you try to add more data to the file (and it cares that the file still can be correctly closed). If you want to check yourself how far you are away from that limit (for example to synchronize the amount of audio and video data) use: long AVI_bytes_remain(avi_t *AVI); ogmtools-1.5/avilib/xio.h0000644000076400234220000000264010032100134015052 0ustar mosuvj00000000000000/* * xio.h * * Copyright (C) Lukas Hejtmanek - January 2004 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef __iolib_h #define __iolib_h #include #include int xio_open(const char *pathname, int flags, ...); ssize_t xio_read(int fd, void *buf, size_t count); ssize_t xio_write(int fd, const void *buf, size_t count); int xio_ftruncate(int fd, off_t length); off_t xio_lseek(int fd, off_t offset, int whence); int xio_close(int fd); int xio_fstat(int fd, struct stat *buf); int xio_lstat(const char *filename, struct stat *buf); int xio_stat(const char *filename, struct stat *buf); int xio_rename(const char *oldpath, const char *newpath); #endif ogmtools-1.5/avilib/avidump.c0000644000076400234220000005547610141724010015740 0ustar mosuvj00000000000000/* * avidump.c * * Copyright (C) Thomas Östreich - June 2001 * * based on code: * (c)94 UP-Vision Computergrafik for c't * Extracts some infos from RIFF files, modified by Gerd Knorr. * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include #include #include #include #include #include #include "xio.h" #if defined(SYS_UNIX) || defined(COMP_MSC) || defined(SYS_APPLE) #define lseek64 lseek #endif //#define AVI_DEBUG #ifdef HAVE_ENDIAN_H # include #endif #if defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) # define SWAP2(x) (((x>>8) & 0x00ff) |\ ((x<<8) & 0xff00)) # define SWAP4(x) (((x>>24) & 0x000000ff) |\ ((x>>8) & 0x0000ff00) |\ ((x<<8) & 0x00ff0000) |\ ((x<<24) & 0xff000000)) # define SWAP8(x) (((SWAP4(x)<<32) & 0xffffffff00000000ULL) |\ (SWAP4(x))) #else # define SWAP2(a) (a) # define SWAP4(a) (a) # define SWAP8(a) (a) #endif typedef unsigned long DWORD; typedef unsigned short WORD; typedef DWORD FOURCC; /* Type of FOUR Character Codes */ typedef unsigned char boolean; #define TRUE 1 #define FALSE 0 #define BUFSIZE 4096 /* Macro to convert expressions of form 'F','O','U','R' to numbers of type FOURCC: */ #if defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) # define MAKEFOURCC(a,b,c,d) ((((DWORD)a)<<24) | (((DWORD)b)<<16) | \ (((DWORD)c)<< 8) | ( (DWORD)d) ) #else # define MAKEFOURCC(a,b,c,d) ( ((DWORD)a) | (((DWORD)b)<< 8) | \ (((DWORD)c)<<16) | (((DWORD)d)<<24) ) #endif /* The only FOURCCs interpreted by this program: */ #define RIFFtag MAKEFOURCC('R','I','F','F') #define LISTtag MAKEFOURCC('L','I','S','T') #define avihtag MAKEFOURCC('a','v','i','h') #define strhtag MAKEFOURCC('s','t','r','h') #define strftag MAKEFOURCC('s','t','r','f') #define vidstag MAKEFOURCC('v','i','d','s') #define audstag MAKEFOURCC('a','u','d','s') #define dmlhtag MAKEFOURCC('d','m','l','h') #define idx1tag MAKEFOURCC('i','d','x','1') #define Tag00db MAKEFOURCC('0','0','d','b') #define Tag00dc MAKEFOURCC('0','0','d','c') #define Tag01db MAKEFOURCC('0','1','d','b') #define Tag01dc MAKEFOURCC('0','1','d','c') #define Tag00wb MAKEFOURCC('0','0','w','b') #define Tag01wb MAKEFOURCC('0','1','w','b') #define Tagwave MAKEFOURCC('f','m','t',' ') #define Tagdata MAKEFOURCC('d','a','t','a') #define TagDATA MAKEFOURCC('D','A','T','A') #define indxtag MAKEFOURCC('i','n','d','x') #define Tag00__ MAKEFOURCC('0','0','_','_') #define Tagix00 MAKEFOURCC('i','x','0','0') #define Tagix01 MAKEFOURCC('i','x','0','1') #define Tagix02 MAKEFOURCC('i','x','0','2') #define Tagix03 MAKEFOURCC('i','x','0','3') /* Build a string from a FOURCC number (s must have room for at least 5 chars) */ static void FOURCC2Str(FOURCC fcc, char* s) { #if defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) s[0]=(fcc >> 24) & 0xFF; s[1]=(fcc >> 16) & 0xFF; s[2]=(fcc >> 8) & 0xFF; s[3]=(fcc ) & 0xFF; #else s[0]=(fcc ) & 0xFF; s[1]=(fcc >> 8) & 0xFF; s[2]=(fcc >> 16) & 0xFF; s[3]=(fcc >> 24) & 0xFF; #endif s[4]=0; } static DWORD fcc_type; #define EoLST 0 #define INT32 1 #define INT16 2 #define FLAGS 3 #define CCODE 4 #define HEX16 5 #define _TAG 6 #define INT8 7 #define INT64 8 struct FLAGLIST { int bit; char *name; }; struct VAL { int type; char *name; struct FLAGLIST *flags; }; struct FLAGLIST flags_avih[] = { { 0x00000010, "hasindex" }, { 0x00000020, "useindex" }, { 0x00000100, "interleaved" }, { 0x00010000, "for_capture" }, { 0x00020000, "copyrighted" }, { 0, NULL } }; struct VAL names_avih[] = { { INT32, "us_frame" }, { INT32, "max_bps" }, { INT32, "pad_gran" }, { FLAGS, "flags", flags_avih }, { INT32, "tot_frames" }, { INT32, "init_frames" }, { INT32, "streams" }, { INT32, "sug_bsize" }, { INT32, "width" }, { INT32, "height" }, { INT32, "scale" }, { INT32, "rate" }, { INT32, "start" }, { INT32, "length" }, { EoLST, NULL } }; struct VAL names_strh[] = { { CCODE, "fcc_handler" }, { FLAGS, "flags" }, { INT32, "priority" }, { INT32, "init_frames" }, { INT32, "scale" }, { INT32, "rate" }, { INT32, "start" }, { INT32, "length" }, { INT32, "sug_bsize" }, { INT32, "quality" }, { INT32, "samp_size" }, { EoLST, NULL } }; struct VAL names_strf_vids[] = { { INT32, "size" }, { INT32, "width" }, { INT32, "height" }, { INT16, "planes" }, { INT16, "bit_cnt" }, { CCODE, "compression" }, { INT32, "image_size" }, { INT32, "xpels_meter" }, { INT32, "ypels_meter" }, { INT32, "num_colors" }, { INT32, "imp_colors" }, { EoLST, NULL } }; struct VAL names_strf_auds[] = { { HEX16, "format" }, { INT16, "channels" }, { INT32, "rate" }, { INT32, "av_bps" }, { INT16, "blockalign" }, { INT16, "bits" }, { INT16, "cbSize" }, { INT16, "wID" }, { INT32, "fdwFlags" }, { INT16, "nBlockSize" }, { INT16, "nFramesPerBlock" }, { INT16, "nCodecDelay" }, { EoLST, NULL } }; struct VAL names_dmlh[] = { { INT32, "frames" }, { EoLST, NULL } }; struct VAL names_idx1[] = { { _TAG, "tag" }, { INT32, "flags" }, { INT32, "pos" }, { INT32, "length" }, { EoLST, NULL } }; struct VAL names_indx[] = { { INT16, "longs/entry"}, { INT8, "index_sub_t" }, { INT8, "index_t" }, { INT32, "entries_used"}, { CCODE, "fcc_handler"}, { INT32, "reserved1"}, { INT32, "reserved2"}, { INT32, "reserved3"}, { EoLST, NULL } }; struct VAL names_stdidx[] = { { INT16, "longs/entry"}, { INT8, "index_sub_t" }, { INT8, "index_t" }, { INT32, "entries_used"}, { CCODE, "fcc_handler"}, { INT64, "base_offset"}, { INT32, "reserved3"}, { EoLST, NULL } }; #define MAX_BUF (4096) static char buffer[MAX_BUF]; static size_t avi_read(int fd, char *buf, size_t len) { size_t n = 0; size_t r = 0; while (r < len) { n = xio_read (fd, buf + r, len - r); if (n <= 0) return r; r += n; } return r; } static size_t avi_write (int fd, char *buf, size_t len) { size_t n = 0; size_t r = 0; while (r < len) { n = xio_write (fd, buf + r, len - r); if (n < 0) return n; r += n; } return r; } static size_t avi_read_write (int fd_in, int fd_out, size_t len) { size_t w=len, z=0; while(w>0) { if(w>MAX_BUF) { z=avi_read(fd_in, buffer, MAX_BUF); if(z<0) return(z); z=avi_write(fd_out, buffer, MAX_BUF); if(z<0) return(z); w -=MAX_BUF; } else { z=avi_read(fd_in, buffer, w); if(z<0) return(z); z=avi_write(fd_out, buffer, w); if(z<0) return(z); w = 0; } } //data > 0 return(len); } static void dump_vals(int fd, int count, struct VAL *names) { DWORD i,j,val32; WORD val16; off_t val64; char val8; for (i = 0; names[i].type != EoLST; i++) { switch (names[i].type) { case INT8: xio_read(fd, &val8, 1); printf("\t%-12s = %d\n",names[i].name,val8); break; case INT64: xio_read(fd, &val64, 8); val64 = SWAP8(val64); printf("\t%-12s = 0x%016llx\n",names[i].name,val64); break; case INT32: xio_read(fd, &val32, 4); val32 = SWAP4(val32); printf("\t%-12s = %ld\n",names[i].name,val32); break; case CCODE: xio_read(fd, &val32,4); val32 = SWAP4(val32); if (val32) { printf("\t%-12s = %c%c%c%c (0x%lx)\n",names[i].name, (int)( val32 & 0xff), (int)((val32 >> 8) & 0xff), (int)((val32 >> 16) & 0xff), (int)((val32 >> 24) & 0xff), val32); } else { printf("\t%-12s = unset (0)\n",names[i].name); } break; case _TAG: xio_read(fd, &val32,4); val32 = SWAP4(val32); if (val32) { printf("\t%-12s = %c%c%c%c\n",names[i].name, (int)( val32 & 0xff), (int)((val32 >> 8) & 0xff), (int)((val32 >> 16) & 0xff), (int)((val32 >> 24) & 0xff)); } else { printf("\t%-12s = unset (0)\n",names[i].name); } break; case FLAGS: xio_read(fd, &val32,4); val32 = SWAP4(val32); printf("\t%-12s = 0x%lx\n",names[i].name,val32); if (names[i].flags) { for (j = 0; names[i].flags[j].bit != 0; j++) if (names[i].flags[j].bit & val32) printf("\t\t0x%x: %s\n", names[i].flags[j].bit,names[i].flags[j].name); } break; case INT16: xio_read(fd, &val16,2); val16 = SWAP2(val16); printf("\t%-12s = %ld\n",names[i].name,(long)val16); break; case HEX16: xio_read(fd, &val16,2); val16 = SWAP2(val16); printf("\t%-12s = 0x%lx\n",names[i].name,(long)val16); break; } } } #if 0 static void hexlog(unsigned char *buf, int count) { int l,i; for (l = 0; l < count; l+= 16) { printf("\t "); for (i = l; i < l+16; i++) { if (i < count) printf("%02x ",buf[i]); else printf(" "); if ((i%4) == 3) printf(" "); } for (i = l; i < l+16; i++) { if (i < count) printf("%c",isprint(buf[i]) ? buf[i] : '.'); } printf("\n"); } } #endif static unsigned char* off_t_to_char(off_t val, int base, int len) { static const char digit[] = "0123456789abcdef"; static char outbuf[32]; char *p = outbuf + sizeof(outbuf); int i; *(--p) = 0; for (i = 0; i < len || val > 0; i++) { *(--p) = digit[ val % base ]; val = val / base; } return (unsigned char *)p; } /* Reads a chunk ID and the chunk's size from file f at actual file position : */ static boolean ReadChunkHead(int fd, FOURCC* ID, DWORD* size) { if (!xio_read(fd, ID, sizeof(FOURCC))) return(FALSE); if (!xio_read(fd, size, sizeof(DWORD))) return(FALSE); *size = SWAP4(*size); #ifdef AVI_DEBUG printf("ReadChunkHead size = %lu\n", *size); #endif return(TRUE); } /* Processing of a chunk. (Will be called recursively!). Processes file f starting at position filepos. f contains filesize bytes. If DesiredTag!=0, ProcessChunk tests, whether the chunk begins with the DesiredTag. If the read chunk is not identical to DesiredTag, an error message is printed. RekDepth determines the recursion depth of the chunk. chunksize is set to the length of the chunk's data (excluding header and padding byte). ProcessChunk prints out information of the chunk to stdout and returns FALSE, if an error occured. */ static off_t datapos_tmp[8]; static boolean ProcessChunk(int fd, off_t filepos, off_t filesize, FOURCC DesiredTag, int RekDepth, DWORD* chunksize) { char tagstr[5]; /* FOURCC of chunk converted to string */ FOURCC chunkid; /* read FOURCC of chunk */ off_t datapos; /* position of data in file to process */ off_t tt; if (filepos>filesize-1) { /* Oops. Must be something wrong! */ printf(" ***** Error: Data would be behind end of file!\n"); } tt=xio_lseek(fd, filepos, SEEK_SET); /* Go to desired file position! */ #ifdef AVI_DEBUG printf("lseek64=%Lu/%Lu (%Lu)\n", tt, filepos, filesize); #endif if (!ReadChunkHead(fd, &chunkid, chunksize)) { /* read chunk header */ printf(" ***** Error reading chunk at filepos 0x%s\n", off_t_to_char(filepos,16,1)); return(FALSE); } FOURCC2Str(chunkid,tagstr); /* now we can PRINT the chunkid */ if (DesiredTag) { /* do we have to test identity? */ if (DesiredTag!=chunkid) { char ds[5]; FOURCC2Str(DesiredTag,ds); printf("\n\n *** Error: Expected chunk '%s', found '%s'\n", ds,tagstr); return(FALSE); } } datapos=filepos+sizeof(FOURCC)+sizeof(DWORD); /* here is the data */ /* print out header: */ #ifdef AVI_DEBUG printf("(%Lu) %*c ID:<%s> Size: %lu\n", filepos ,(RekDepth+1)*4,' ',tagstr, *chunksize); #else printf("(0x%s) %*c ID:<%s> Size: 0x%08lx %8lu\n", off_t_to_char(filepos,16,8),(RekDepth+1)*4,' ',tagstr, *chunksize, *chunksize); #endif if (datapos + ((*chunksize+1)&~1) > filesize) { /* too long? */ printf(" ***** Error: Chunk exceeds file\n"); } switch (chunkid) { /* Depending on the ID of the chunk and the internal state, the different IDs can be interpreted. At the moment the only interpreted chunks are RIFF- and LIST-chunks. For all other chunks only their header is printed out. */ case RIFFtag: case LISTtag: { DWORD datashowed=0; FOURCC formtype; /* format of chunk */ char formstr[5]; /* format of chunk converted to string */ DWORD subchunksize=0; /* size of a read subchunk */ if (!read(fd, &formtype, sizeof(FOURCC))) printf("ERROR\n"); /* read the form type */ FOURCC2Str(formtype,formstr); /* make it printable */ /* print out the indented form of the chunk: */ if (chunkid==RIFFtag) printf("%12c %*c Form Type = <%s>\n", ' ',(RekDepth+1)*4,' ',formstr); else printf("%12c %*c List Type = <%s>\n", ' ',(RekDepth+1)*4,' ',formstr); datashowed=sizeof(FOURCC); /* we showed the form type */ datapos+=(off_t) datashowed; /* for the rest of the routine */ while (datashowed<*chunksize) { /* while not showed all: */ long subchunklen; /* complete size of a subchunk */ datapos_tmp[RekDepth]=datapos; /* recurse for subchunks of RIFF and LIST chunks: */ #ifdef AVI_DEBUG printf("enter [%d] size=%lu pos=%Lu left=%lu\n", RekDepth, subchunksize, datapos, *chunksize-datashowed); #endif if (!ProcessChunk(fd, datapos, filesize, 0, RekDepth+1, &subchunksize)) return(FALSE); subchunklen = sizeof(FOURCC) + /* this is the complete.. */ sizeof(DWORD) + /* .. size of the subchunk */ ((subchunksize+1) & ~1); datashowed += subchunklen; /* we showed the subchunk */ datapos = datapos_tmp[RekDepth] + (off_t) subchunklen; /* for the rest of the loop */ #ifdef AVI_DEBUG printf(" exit [%d] size=%lu/%lu pos=%Lu left=%lu\n", RekDepth, subchunksize, subchunklen, datapos, *chunksize-datashowed); #endif } } break; /* Feel free to put your extensions here! */ case avihtag: dump_vals(fd,sizeof(names_avih)/sizeof(struct VAL),names_avih); break; case strhtag: { char typestr[5]; xio_read(fd, &fcc_type,sizeof(FOURCC)); FOURCC2Str(fcc_type,typestr); printf("\tfcc_type = %s\n",typestr); dump_vals(fd,sizeof(names_strh)/sizeof(struct VAL),names_strh); break; } case strftag: switch (fcc_type) { case vidstag: dump_vals(fd,sizeof(names_strf_vids)/sizeof(struct VAL),names_strf_vids); break; case audstag: dump_vals(fd,sizeof(names_strf_auds)/sizeof(char*),names_strf_auds); break; default: printf("unknown\n"); break; } break; case Tagwave: dump_vals(fd,sizeof(names_strf_auds)/sizeof(char*),names_strf_auds); break; case indxtag: { long chunks=*chunksize-sizeof(names_indx)/sizeof(char*); off_t offset; DWORD size, duration; long u=0; off_t indxend = datapos + chunks; dump_vals(fd,sizeof(names_indx)/sizeof(char*),names_indx); while (datapos < indxend) { xio_read(fd, &offset,8); xio_read(fd, &size, 4); xio_read(fd, &duration,4); offset = SWAP8(offset); size = SWAP4(size); duration = SWAP4(duration); if (size!=0) printf("\t\t [%6ld] 0x%016llx 0x%08lx %8d\n", u++, offset, size, (int)duration); datapos += 16; } break; } case Tagix00: case Tagix01: case Tagix02: case Tagix03: { long chunks=*chunksize-sizeof(names_stdidx)/sizeof(char*); unsigned int offset, size, key; long u=0; off_t indxend = datapos + chunks; dump_vals(fd,sizeof(names_stdidx)/sizeof(char*),names_stdidx); while (datapos < indxend) { xio_read(fd, &offset,4); xio_read(fd, &size, 4); offset = SWAP4(offset); size = SWAP4(size); key = size; key = key&0x80000000?0:1; size &= 0x7fffffff; if (size!=0) printf("\t\t [%6ld] 0x%08x 0x%08x key=%s\n", u++, offset, size, key?"yes":"no"); datapos += 8; } } break; case idx1tag: { off_t idxend = datapos+*chunksize; while (datapos> 8) & 0xff), (int)((val32 >> 16) & 0xff), (int)((val32 >> 24) & 0xff)); } else printf("\t\t %s=%c%c%c%c ", "tag", (int)( val32 & 0xff), (int)((val32 >> 8) & 0xff), (int)((val32 >> 16) & 0xff), (int)((val32 >> 24) & 0xff)); //flag xio_read(fd, &val32, 4); val32 = SWAP4(val32); printf("flags=%02ld ",val32); //pos xio_read(fd, &val32, 4); val32 = SWAP4(val32); printf("0x%08lx",val32); //size xio_read(fd, &val32, 4); val32 = SWAP4(val32); printf("%8ld\n",val32); datapos+=16; } } break; case dmlhtag: dump_vals(fd,sizeof(names_dmlh)/sizeof(struct VAL),names_dmlh); break; } return(TRUE); } static DWORD size; static int eos=0; static boolean DumpChunk(int fd, off_t filepos, off_t filesize, FOURCC DesiredTag, int RekDepth, DWORD* chunksize, int mode) { char tagstr[5]; /* FOURCC of chunk converted to string */ FOURCC chunkid; /* read FOURCC of chunk */ off_t datapos; /* position of data in file to process */ if (filepos>filesize-1) /* Oops. Must be something wrong! */ return(FALSE); xio_lseek(fd, filepos, SEEK_SET); if (!ReadChunkHead(fd, &chunkid,chunksize)) { /* read chunk header */ return(FALSE); } FOURCC2Str(chunkid,tagstr); /* now we can PRINT the chunkid */ if (DesiredTag) { /* do we have to test identity? */ if (DesiredTag!=chunkid) { char ds[5]; FOURCC2Str(DesiredTag,ds); return(FALSE); } } datapos=filepos+sizeof(FOURCC)+sizeof(DWORD); /* here is the data */ //support for broken files if (datapos + ((*chunksize+1)&~1) > filesize) { size = filesize-datapos; eos=1; } else { size = *chunksize; } switch (chunkid) { /* Depending on the ID of the chunk and the internal state, the different IDs can be interpreted. At the moment the only interpreted chunks are RIFF- and LIST-chunks. For all other chunks only their header is printed out. */ case RIFFtag: case LISTtag: { DWORD datashowed; FOURCC formtype; /* format of chunk */ char formstr[5]; /* format of chunk converted to string */ DWORD subchunksize; /* size of a read subchunk */ xio_read(fd, &formtype,sizeof(FOURCC)); /* read the form type */ FOURCC2Str(formtype,formstr); /* make it printable */ datashowed=sizeof(FOURCC); /* we showed the form type */ datapos+=(off_t)datashowed; /* for the rest of the routine */ while (datashowed<*chunksize) { /* while not showed all: */ long subchunklen; /* complete size of a subchunk */ /* recurse for subchunks of RIFF and LIST chunks: */ if (!DumpChunk(fd, datapos,filesize,0, RekDepth+1,&subchunksize,mode)) return(FALSE); subchunklen = sizeof(FOURCC) + /* this is the complete.. */ sizeof(DWORD) + /* .. size of the subchunk */ ((subchunksize+1) & ~1); datashowed += subchunklen; /* we showed the subchunk */ datapos += (off_t) subchunklen; /* for the rest of the loop */ } } break; case Tag01wb: case Tag00wb: if(mode==1) { xio_lseek(fd, datapos, SEEK_SET); if(avi_read_write(fd, STDOUT_FILENO, size)!=size) return(FALSE); } if(eos) return(FALSE); break; case Tag00db: case Tag00dc: case Tag01db: case Tag01dc: case Tag00__: if(mode==0) { xio_lseek(fd, datapos, SEEK_SET); if(avi_read_write(fd, STDOUT_FILENO, size)!=size) return(FALSE); } if(eos) return(FALSE); break; case Tagdata: case TagDATA: if(mode==2) { xio_lseek(fd, datapos, SEEK_SET); if(avi_read_write(fd, STDOUT_FILENO, size)!=size) return(FALSE); } if(eos) exit(1); break; } return(TRUE); } int AVI_scan(char *file_name) { off_t filesize; /* its size */ off_t filepos; int fd; DWORD chunksize; /* size of the RIFF chunk data */ #if defined(SYS_WINDOWS) if (!(fd=open(file_name, O_RDONLY|O_BINARY))) { #else if (!(fd=xio_open(file_name, O_RDONLY))) { #endif printf("\n\n *** Error opening file %s. Program aborted!\n", file_name); return(1); } filesize = xio_lseek(fd, 0, SEEK_END); xio_lseek(fd, 0, SEEK_SET); printf("Contents of file %s (%s/", file_name, off_t_to_char(filesize,10,1)); printf("0x%s bytes):\n\n",off_t_to_char(filesize,16,1)); for (filepos = 0; filepos < filesize;) { chunksize = 0; if (!ProcessChunk(fd, filepos,filesize,RIFFtag,0,&chunksize)) break; filepos += chunksize + 8; printf("\n"); } xio_close(fd); return(0); } int AVI_dump(char *file_name, int mode) { off_t filesize; /* its size */ off_t filepos; int fd; DWORD chunksize; /* size of the RIFF chunk data */ #if defined(SYS_WINDOWS) if (!(fd=open(file_name,O_RDONLY|O_BINARY))) return(1); #else if (!(fd=xio_open(file_name,O_RDONLY))) return(1); #endif filesize = xio_lseek(fd, 0, SEEK_END); xio_lseek(fd, 0, SEEK_SET); for (filepos = 0; filepos < filesize;) { chunksize = 0; if (!DumpChunk(fd,filepos,filesize,RIFFtag,0,&chunksize,mode)) break; filepos += chunksize + 8; } xio_close(fd); return(0); } ogmtools-1.5/avilib/avilib.c0000644000076400234220000031735210141724010015533 0ustar mosuvj00000000000000/* * avilib.c * * Copyright (C) Thomas Östreich - June 2001 * multiple audio track support Copyright (C) 2002 Thomas Östreich * * Original code: * Copyright (C) 1999 Rainer Johanni * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include "avilib.h" #include "xio.h" #define INFO_LIST // add a new riff chunk after XX MB //#define NEW_RIFF_THRES (1900*1024*1024) #define NEW_RIFF_THRES (1900*1024*1024) //#define NEW_RIFF_THRES (10*1024*1024) // Maximum number of indices per stream #define NR_IXNN_CHUNKS 32 #define DEBUG_ODML #undef DEBUG_ODML /* The following variable indicates the kind of error */ long AVI_errno = 0; #define MAX_INFO_STRLEN 64 static char id_str[MAX_INFO_STRLEN]; #define FRAME_RATE_SCALE 1000000 /******************************************************************* * * * Utilities for writing an AVI File * * * *******************************************************************/ static ssize_t avi_read(int fd, char *buf, size_t len) { ssize_t n = 0; ssize_t r = 0; while (r < len) { n = xio_read (fd, buf + r, len - r); if (n == 0) break; if (n < 0) { if (errno == EINTR) continue; else break; } r += n; } return r; } static ssize_t avi_write (int fd, char *buf, size_t len) { ssize_t n = 0; ssize_t r = 0; while (r < len) { n = xio_write (fd, buf + r, len - r); if (n < 0) return n; r += n; } return r; } /* HEADERBYTES: The number of bytes to reserve for the header */ #define HEADERBYTES 2048 /* AVI_MAX_LEN: The maximum length of an AVI file, we stay a bit below the 2GB limit (Remember: 2*10^9 is smaller than 2 GB) */ #define AVI_MAX_LEN (UINT_MAX-(1<<20)*16-HEADERBYTES) #define PAD_EVEN(x) ( ((x)+1) & ~1 ) /* Copy n into dst as a 4 or 2 byte, little endian number. Should also work on big endian machines */ static void long2str(unsigned char *dst, int32_t n) { dst[0] = (n )&0xff; dst[1] = (n>> 8)&0xff; dst[2] = (n>>16)&0xff; dst[3] = (n>>24)&0xff; } #ifdef WORDS_BIGENDIAN static void short2str(unsigned char *dst, int32_t n) { dst[0] = (n )&0xff; dst[1] = (n>> 8)&0xff; } #endif /* Convert a string of 4 or 2 bytes to a number, also working on big endian machines */ static uint64_t str2ullong(unsigned char *str) { uint64_t r = (str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24)); uint64_t s = (str[4] | (str[5]<<8) | (str[6]<<16) | (str[7]<<24)); return ((s<<32)&0xffffffff00000000ULL)|(r&0xffffffffULL); } static uint32_t str2ulong(unsigned char *str) { return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) ); } static uint32_t str2ushort(unsigned char *str) { return ( str[0] | (str[1]<<8) ); } // bit 31 denotes a keyframe static uint32_t str2ulong_len (unsigned char *str) { return str2ulong(str) & 0x7fffffff; } // if bit 31 is 0, its a keyframe static uint32_t str2ulong_key (unsigned char *str) { uint32_t c = str2ulong(str); c &= 0x80000000; if (c == 0) return 0x10; else return 0; } /* Calculate audio sample size from number of bits and number of channels. This may have to be adjusted for eg. 12 bits and stereo */ static int avi_sampsize(avi_t *AVI, int j) { int s; s = ((AVI->track[j].a_bits+7)/8)*AVI->track[j].a_chans; // if(s==0) s=1; /* avoid possible zero divisions */ if(s<4) s=4; /* avoid possible zero divisions */ return s; } /* Add a chunk (=tag and data) to the AVI file, returns -1 on write error, 0 on success */ static int avi_add_chunk(avi_t *AVI, unsigned char *tag, unsigned char *data, int length) { unsigned char c[8]; char p=0; /* Copy tag and length int c, so that we need only 1 write system call for these two values */ memcpy(c,tag,4); long2str(c+4,length); /* Output tag, length and data, restore previous position if the write fails */ if( avi_write(AVI->fdes,(char *)c,8) != 8 || avi_write(AVI->fdes,(char *)data,length) != length || avi_write(AVI->fdes,&p,length&1) != (length&1)) // if len is uneven, write a pad byte { xio_lseek(AVI->fdes,AVI->pos,SEEK_SET); AVI_errno = AVI_ERR_WRITE; return -1; } /* Update file position */ AVI->pos += 8 + PAD_EVEN(length); //fprintf(stderr, "pos=%lu %s\n", AVI->pos, tag); return 0; } #define OUTD(n) long2str(ix00+bl,n); bl+=4 #define OUTW(n) ix00[bl] = (n)&0xff; ix00[bl+1] = (n>>8)&0xff; bl+=2 #define OUTC(n) ix00[bl] = (n)&0xff; bl+=1 #define OUTS(s) memcpy(ix00+bl,s,4); bl+=4 // this does the physical writeout of the ix## structure static int avi_ixnn_entry(avi_t *AVI, avistdindex_chunk *ch, avisuperindex_entry *en) { int bl, k; unsigned int max = ch->nEntriesInUse * sizeof (uint32_t) * ch->wLongsPerEntry + 24; // header char *ix00 = malloc (max); char dfcc[5]; memcpy (dfcc, ch->fcc, 4); dfcc[4] = 0; bl = 0; if (en) { en->qwOffset = AVI->pos; en->dwSize = max; //en->dwDuration = ch->nEntriesInUse -1; // NUMBER OF stream ticks == frames for video/samples for audio } #ifdef DEBUG_ODML //printf ("ODML Write %s: Entries %ld size %d \n", dfcc, ch->nEntriesInUse, max); #endif //OUTS(ch->fcc); //OUTD(max); OUTW(ch->wLongsPerEntry); OUTC(ch->bIndexSubType); OUTC(ch->bIndexType); OUTD(ch->nEntriesInUse); OUTS(ch->dwChunkId); OUTD(ch->qwBaseOffset&0xffffffff); OUTD((ch->qwBaseOffset>>32)&0xffffffff); OUTD(ch->dwReserved3); for (k = 0; k < ch->nEntriesInUse; k++) { OUTD(ch->aIndex[k].dwOffset); OUTD(ch->aIndex[k].dwSize); } avi_add_chunk (AVI, ch->fcc, ix00, max); free(ix00); return 0; } #undef OUTS #undef OUTW #undef OUTD #undef OUTC // inits a super index structure including its enclosed stdindex static int avi_init_super_index(avi_t *AVI, unsigned char *idxtag, avisuperindex_chunk **si) { int k; avisuperindex_chunk *sil = NULL; if ((sil = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk))) == NULL) { AVI_errno = AVI_ERR_NO_MEM; return -1; } memcpy (sil->fcc, "indx", 4); sil->dwSize = 0; // size of this chunk sil->wLongsPerEntry = 4; sil->bIndexSubType = 0; sil->bIndexType = AVI_INDEX_OF_INDEXES; sil->nEntriesInUse = 0; // none are in use memcpy (sil->dwChunkId, idxtag, 4); memset (sil->dwReserved, 0, sizeof (sil->dwReserved)); // NR_IXNN_CHUNKS == allow 32 indices which means 32 GB files -- arbitrary sil->aIndex = malloc (sil->wLongsPerEntry * NR_IXNN_CHUNKS * sizeof (uint32_t)); if (!sil->aIndex) { AVI_errno = AVI_ERR_NO_MEM; return -1; } memset (sil->aIndex, 0, sil->wLongsPerEntry * NR_IXNN_CHUNKS * sizeof (uint32_t)); sil->stdindex = malloc (NR_IXNN_CHUNKS * sizeof (avistdindex_chunk *)); if (!sil->stdindex) { AVI_errno = AVI_ERR_NO_MEM; return -1; } for (k = 0; k < NR_IXNN_CHUNKS; k++) { sil->stdindex[k] = malloc (sizeof (avistdindex_chunk)); // gets rewritten later sil->stdindex[k]->qwBaseOffset = (uint64_t)k * NEW_RIFF_THRES; } *si = sil; return 0; } // fills an alloc'ed stdindex structure and mallocs some entries for the actual chunks static int avi_add_std_index(avi_t *AVI, unsigned char *idxtag, unsigned char *strtag, avistdindex_chunk *stdil) { memcpy (stdil->fcc, idxtag, 4); stdil->dwSize = 4096; stdil->wLongsPerEntry = 2; //sizeof(avistdindex_entry)/sizeof(uint32_t); stdil->bIndexSubType = 0; stdil->bIndexType = AVI_INDEX_OF_CHUNKS; stdil->nEntriesInUse = 0; // cp 00db ChunkId memcpy(stdil->dwChunkId, strtag, 4); //stdil->qwBaseOffset = AVI->video_superindex->aIndex[ cur_std_idx ]->qwOffset; stdil->aIndex = malloc(stdil->dwSize * sizeof (uint32_t) * stdil->wLongsPerEntry); if (!stdil->aIndex) { AVI_errno = AVI_ERR_NO_MEM; return -1; } return 0; } static int avi_add_odml_index_entry_core(avi_t *AVI, long flags, int64_t pos, unsigned long len, avistdindex_chunk *si) { int cur_chunk_idx; // put new chunk into index si->nEntriesInUse++; cur_chunk_idx = si->nEntriesInUse-1; // need to fetch more memory if (cur_chunk_idx >= si->dwSize) { si->dwSize += 4096; si->aIndex = realloc ( si->aIndex, si->dwSize * sizeof (uint32_t) * si->wLongsPerEntry); } if(len>AVI->max_len) AVI->max_len=len; // if bit 31 is set, it is NOT a keyframe if (flags != 0x10) { len |= 0x80000000; } si->aIndex [ cur_chunk_idx ].dwSize = len; si->aIndex [ cur_chunk_idx ].dwOffset = pos - si->qwBaseOffset + 8; //printf("ODML: POS: 0x%lX\n", si->aIndex [ cur_chunk_idx ].dwOffset); return 0; } static int avi_add_odml_index_entry(avi_t *AVI, unsigned char *tag, long flags, int64_t pos, unsigned long len) { char fcc[5]; int audio = (strchr (tag, 'w')?1:0); int video = !audio; unsigned int cur_std_idx; int audtr; int64_t towrite = 0LL; if (video) { if (!AVI->video_superindex) { if (avi_init_super_index(AVI, "ix00", &AVI->video_superindex) < 0) return -1; AVI->video_superindex->nEntriesInUse++; cur_std_idx = AVI->video_superindex->nEntriesInUse-1; if (avi_add_std_index (AVI, "ix00", "00db", AVI->video_superindex->stdindex[ cur_std_idx ]) < 0) return -1; } // init } // video if (audio) { fcc[0] = 'i'; fcc[1] = 'x'; fcc[2] = tag[0]; fcc[3] = tag[1]; fcc[4] = '\0'; if (!AVI->track[AVI->aptr].audio_superindex) { #ifdef DEBUG_ODML printf("ODML: fcc = %s\n", fcc); #endif if (avi_init_super_index(AVI, fcc, &AVI->track[AVI->aptr].audio_superindex) < 0) return -1; AVI->track[AVI->aptr].audio_superindex->nEntriesInUse++; sprintf(fcc, "ix%02d", AVI->aptr+1); if (avi_add_std_index (AVI, fcc, tag, AVI->track[AVI->aptr].audio_superindex->stdindex[ AVI->track[AVI->aptr].audio_superindex->nEntriesInUse - 1 ]) < 0 ) return -1; } // init } towrite = 0; if (AVI->video_superindex) { cur_std_idx = AVI->video_superindex->nEntriesInUse-1; towrite += AVI->video_superindex->stdindex[cur_std_idx]->nEntriesInUse*8 + 4+4+2+1+1+4+4+8+4; if (cur_std_idx == 0) { towrite += AVI->n_idx*16 + 8; towrite += HEADERBYTES; } } for (audtr=0; audtranum; audtr++) { if (AVI->track[audtr].audio_superindex) { cur_std_idx = AVI->track[audtr].audio_superindex->nEntriesInUse-1; towrite += AVI->track[audtr].audio_superindex->stdindex[cur_std_idx]->nEntriesInUse*8 + 4+4+2+1+1+4+4+8+4; } } towrite += len + (len&1) + 8; //printf("ODML: towrite = 0x%llX = %lld\n", towrite, towrite); if (AVI->video_superindex && (int64_t)(AVI->pos+towrite) > (int64_t)((int64_t)NEW_RIFF_THRES*AVI->video_superindex->nEntriesInUse)) { fprintf(stderr, "Adding a new RIFF chunk: %d\n", AVI->video_superindex->nEntriesInUse); // rotate ALL indices AVI->video_superindex->nEntriesInUse++; cur_std_idx = AVI->video_superindex->nEntriesInUse-1; if (AVI->video_superindex->nEntriesInUse > NR_IXNN_CHUNKS) { fprintf (stderr, "Internal error in avilib - redefine NR_IXNN_CHUNKS\n"); fprintf (stderr, "[avilib dump] cur_std_idx=%d NR_IXNN_CHUNKS=%d" "POS=%lld towrite=%lld\n", cur_std_idx,NR_IXNN_CHUNKS, AVI->pos, towrite); return -1; } if (avi_add_std_index (AVI, "ix00", "00db", AVI->video_superindex->stdindex[ cur_std_idx ]) < 0) return -1; for (audtr = 0; audtr < AVI->anum; audtr++) { char aud[5]; if (!AVI->track[audtr].audio_superindex) { // not initialized -> no index continue; } AVI->track[audtr].audio_superindex->nEntriesInUse++; sprintf(fcc, "ix%02d", audtr+1); sprintf(aud, "0%01dwb", audtr+1); if (avi_add_std_index (AVI, fcc, aud, AVI->track[audtr].audio_superindex->stdindex[ AVI->track[audtr].audio_superindex->nEntriesInUse - 1 ]) < 0 ) return -1; } // write the new riff; if (cur_std_idx > 0) { // dump the _previous_ == already finished index avi_ixnn_entry (AVI, AVI->video_superindex->stdindex[cur_std_idx - 1], &AVI->video_superindex->aIndex[cur_std_idx - 1]); AVI->video_superindex->aIndex[cur_std_idx - 1].dwDuration = AVI->video_superindex->stdindex[cur_std_idx - 1]->nEntriesInUse - 1; for (audtr = 0; audtr < AVI->anum; audtr++) { if (!AVI->track[audtr].audio_superindex) { // not initialized -> no index continue; } avi_ixnn_entry (AVI, AVI->track[audtr].audio_superindex->stdindex[cur_std_idx - 1], &AVI->track[audtr].audio_superindex->aIndex[cur_std_idx - 1]); AVI->track[audtr].audio_superindex->aIndex[cur_std_idx - 1].dwDuration = AVI->track[audtr].audio_superindex->stdindex[cur_std_idx - 1]->nEntriesInUse - 1; if (AVI->track[audtr].a_fmt == 0x1) { AVI->track[audtr].audio_superindex->aIndex[cur_std_idx - 1].dwDuration *= AVI->track[audtr].a_bits*AVI->track[audtr].a_rate*AVI->track[audtr].a_chans/800; } } // XXX: dump idx1 structure if (cur_std_idx == 1) { avi_add_chunk(AVI, (unsigned char *)"idx1", (unsigned char *)AVI->idx, AVI->n_idx*16); // qwBaseOffset will contain the start of the second riff chunk } // Fix the Offsets later at closing time avi_add_chunk(AVI, (unsigned char *)"RIFF", "AVIXLIST\0\0\0\0movi", 16); AVI->video_superindex->stdindex[ cur_std_idx ]->qwBaseOffset = AVI->pos -16 -8; #ifdef DEBUG_ODML printf("ODML: RIFF No.%02d at Offset 0x%llX\n", cur_std_idx, AVI->pos -16 -8); #endif for (audtr = 0; audtr < AVI->anum; audtr++) { if (AVI->track[audtr].audio_superindex) AVI->track[audtr].audio_superindex->stdindex[ cur_std_idx ]->qwBaseOffset = AVI->pos -16 -8; } // now we can be sure AVI->is_opendml++; } } if (video) { avi_add_odml_index_entry_core(AVI, flags, AVI->pos, len, AVI->video_superindex->stdindex[ AVI->video_superindex->nEntriesInUse-1 ]); AVI->total_frames++; } // video if (audio) { avi_add_odml_index_entry_core(AVI, flags, AVI->pos, len, AVI->track[AVI->aptr].audio_superindex->stdindex[ AVI->track[AVI->aptr].audio_superindex->nEntriesInUse-1 ]); } return 0; } // #undef NR_IXNN_CHUNKS static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsigned long pos, unsigned long len) { void *ptr; if(AVI->n_idx>=AVI->max_idx) { ptr = realloc((void *)AVI->idx,(AVI->max_idx+4096)*16); if(ptr == 0) { AVI_errno = AVI_ERR_NO_MEM; return -1; } AVI->max_idx += 4096; AVI->idx = (unsigned char((*)[16]) ) ptr; } /* Add index entry */ // fprintf(stderr, "INDEX %s %ld %lu %lu\n", tag, flags, pos, len); memcpy(AVI->idx[AVI->n_idx],tag,4); long2str(AVI->idx[AVI->n_idx]+ 4,flags); long2str(AVI->idx[AVI->n_idx]+ 8, pos); long2str(AVI->idx[AVI->n_idx]+12, len); /* Update counter */ AVI->n_idx++; if(len>AVI->max_len) AVI->max_len=len; return 0; } /* Returns 1 if more audio is in that video junk */ int AVI_can_read_audio(avi_t *AVI) { if(AVI->mode==AVI_MODE_WRITE) { return -1; } if(!AVI->video_index) { return -1; } if(!AVI->track[AVI->aptr].audio_index) { return -1; } // is it -1? the last ones got left out --tibit //if (AVI->track[AVI->aptr].audio_posc>=AVI->track[AVI->aptr].audio_chunks-1) { if (AVI->track[AVI->aptr].audio_posc>=AVI->track[AVI->aptr].audio_chunks) { return 0; } if (AVI->video_pos >= AVI->video_frames) return 1; if (AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].pos < AVI->video_index[AVI->video_pos].pos) return 1; else return 0; } /* AVI_open_output_file: Open an AVI File and write a bunch of zero bytes as space for the header. returns a pointer to avi_t on success, a zero pointer on error */ avi_t* AVI_open_output_file(char * filename) { avi_t *AVI; int i; unsigned char AVI_header[HEADERBYTES]; /* Allocate the avi_t struct and zero it */ AVI = (avi_t *) malloc(sizeof(avi_t)); if(AVI==0) { AVI_errno = AVI_ERR_NO_MEM; return 0; } memset((void *)AVI,0,sizeof(avi_t)); /* Since Linux needs a long time when deleting big files, we do not truncate the file when we open it. Instead it is truncated when the AVI file is closed */ #if defined(SYS_UNIX) || defined(SYS_APPLE) AVI->fdes = xio_open(filename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); #elif defined(COMP_MINGW) || defined(COMP_CYGWIN) AVI->fdes = xio_open(filename, O_RDWR|O_CREAT|O_BINARY, S_IRUSR | S_IWUSR); #else AVI->fdes = xio_open(filename, O_RDWR|O_CREAT|O_BINARY, S_IRUSR | S_IWUSR | S_IGRP | S_IROTH); #endif if (AVI->fdes < 0) { AVI_errno = AVI_ERR_OPEN; free(AVI); return 0; } /* Write out HEADERBYTES bytes, the header will go here when we are finished with writing */ for (i=0;ifdes,(char *)AVI_header,HEADERBYTES); if (i != HEADERBYTES) { xio_close(AVI->fdes); AVI_errno = AVI_ERR_WRITE; free(AVI); return 0; } AVI->pos = HEADERBYTES; AVI->mode = AVI_MODE_WRITE; /* open for writing */ //init AVI->anum = 0; AVI->aptr = 0; return AVI; } void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compressor) { /* may only be called if file is open for writing */ if(AVI->mode==AVI_MODE_READ) return; AVI->width = width; AVI->height = height; AVI->fps = fps; if(strncmp(compressor, "RGB", 3)==0) { memset(AVI->compressor, 0, 4); } else { memcpy(AVI->compressor,compressor,4); } AVI->compressor[4] = 0; avi_update_header(AVI); } void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format, long mp3rate) { /* may only be called if file is open for writing */ if(AVI->mode==AVI_MODE_READ) return; //inc audio tracks AVI->aptr=AVI->anum; ++AVI->anum; if(AVI->anum > AVI_MAX_TRACKS) { fprintf(stderr, "error - only %d audio tracks supported\n", AVI_MAX_TRACKS); exit(1); } AVI->track[AVI->aptr].a_chans = channels; AVI->track[AVI->aptr].a_rate = rate; AVI->track[AVI->aptr].a_bits = bits; AVI->track[AVI->aptr].a_fmt = format; AVI->track[AVI->aptr].mp3rate = mp3rate; avi_update_header(AVI); } #define OUT4CC(s) \ if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4 #define OUTLONG(n) \ if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb,n); nhb += 4 #define OUTSHRT(n) \ if(nhb<=HEADERBYTES-2) { \ AVI_header[nhb ] = (n )&0xff; \ AVI_header[nhb+1] = (n>>8)&0xff; \ } \ nhb += 2 #define OUTCHR(n) \ if(nhb<=HEADERBYTES-1) { \ AVI_header[nhb ] = (n )&0xff; \ } \ nhb += 1 #define OUTMEM(d, s) \ { \ unsigned int s_ = (s); \ if(nhb <= HEADERBYTES-s_) \ memcpy(AVI_header+nhb, (d), s_); \ nhb += s_; \ } //ThOe write preliminary AVI file header: 0 frames, max vid/aud size int avi_update_header(avi_t *AVI) { int njunk, sampsize, hasIndex, ms_per_frame, frate, flag; int movi_len, hdrl_start, strl_start, j; unsigned char AVI_header[HEADERBYTES]; long nhb; unsigned long xd_size, xd_size_align2; //assume max size movi_len = AVI_MAX_LEN - HEADERBYTES + 4; //assume index will be written hasIndex=1; if(AVI->fps < 0.001) { frate=0; ms_per_frame=0; } else { frate = (int) (FRAME_RATE_SCALE*AVI->fps + 0.5); ms_per_frame=(int) (1000000/AVI->fps + 0.5); } /* Prepare the file header */ nhb = 0; /* The RIFF header */ OUT4CC ("RIFF"); OUTLONG(movi_len); // assume max size OUT4CC ("AVI "); /* Start the header list */ OUT4CC ("LIST"); OUTLONG(0); /* Length of list in bytes, don't know yet */ hdrl_start = nhb; /* Store start position */ OUT4CC ("hdrl"); /* The main AVI header */ /* The Flags in AVI File header */ #define AVIF_HASINDEX 0x00000010 /* Index at end of file */ #define AVIF_MUSTUSEINDEX 0x00000020 #define AVIF_ISINTERLEAVED 0x00000100 #define AVIF_TRUSTCKTYPE 0x00000800 /* Use CKType to find key frames */ #define AVIF_WASCAPTUREFILE 0x00010000 #define AVIF_COPYRIGHTED 0x00020000 OUT4CC ("avih"); OUTLONG(56); /* # of bytes to follow */ OUTLONG(ms_per_frame); /* Microseconds per frame */ //ThOe ->0 // OUTLONG(10000000); /* MaxBytesPerSec, I hope this will never be used */ OUTLONG(0); OUTLONG(0); /* PaddingGranularity (whatever that might be) */ /* Other sources call it 'reserved' */ flag = AVIF_ISINTERLEAVED; if(hasIndex) flag |= AVIF_HASINDEX; if(hasIndex && AVI->must_use_index) flag |= AVIF_MUSTUSEINDEX; OUTLONG(flag); /* Flags */ OUTLONG(0); // no frames yet OUTLONG(0); /* InitialFrames */ OUTLONG(AVI->anum+1); OUTLONG(0); /* SuggestedBufferSize */ OUTLONG(AVI->width); /* Width */ OUTLONG(AVI->height); /* Height */ /* MS calls the following 'reserved': */ OUTLONG(0); /* TimeScale: Unit used to measure time */ OUTLONG(0); /* DataRate: Data rate of playback */ OUTLONG(0); /* StartTime: Starting time of AVI data */ OUTLONG(0); /* DataLength: Size of AVI data chunk */ /* Start the video stream list ---------------------------------- */ OUT4CC ("LIST"); OUTLONG(0); /* Length of list in bytes, don't know yet */ strl_start = nhb; /* Store start position */ OUT4CC ("strl"); /* The video stream header */ OUT4CC ("strh"); OUTLONG(56); /* # of bytes to follow */ OUT4CC ("vids"); /* Type */ OUT4CC (AVI->compressor); /* Handler */ OUTLONG(0); /* Flags */ OUTLONG(0); /* Reserved, MS says: wPriority, wLanguage */ OUTLONG(0); /* InitialFrames */ OUTLONG(FRAME_RATE_SCALE); /* Scale */ OUTLONG(frate); /* Rate: Rate/Scale == samples/second */ OUTLONG(0); /* Start */ OUTLONG(0); // no frames yet OUTLONG(0); /* SuggestedBufferSize */ OUTLONG(-1); /* Quality */ OUTLONG(0); /* SampleSize */ OUTLONG(0); /* Frame */ OUTLONG(0); /* Frame */ // OUTLONG(0); /* Frame */ //OUTLONG(0); /* Frame */ /* The video stream format */ xd_size = AVI->extradata_size; xd_size_align2 = (AVI->extradata_size+1) & ~1; OUT4CC ("strf"); OUTLONG(40 + xd_size_align2);/* # of bytes to follow */ OUTLONG(40 + xd_size); /* Size */ OUTLONG(AVI->width); /* Width */ OUTLONG(AVI->height); /* Height */ OUTSHRT(1); OUTSHRT(24); /* Planes, Count */ OUT4CC (AVI->compressor); /* Compression */ // ThOe (*3) OUTLONG(AVI->width*AVI->height*3); /* SizeImage (in bytes?) */ OUTLONG(0); /* XPelsPerMeter */ OUTLONG(0); /* YPelsPerMeter */ OUTLONG(0); /* ClrUsed: Number of colors used */ OUTLONG(0); /* ClrImportant: Number of colors important */ // write extradata if (xd_size > 0 && AVI->extradata) { OUTMEM(AVI->extradata, xd_size); if (xd_size != xd_size_align2) { OUTCHR(0); } } /* Finish stream list, i.e. put number of bytes in the list to proper pos */ long2str(AVI_header+strl_start-4,nhb-strl_start); /* Start the audio stream list ---------------------------------- */ for(j=0; janum; ++j) { sampsize = avi_sampsize(AVI, j); OUT4CC ("LIST"); OUTLONG(0); /* Length of list in bytes, don't know yet */ strl_start = nhb; /* Store start position */ OUT4CC ("strl"); /* The audio stream header */ OUT4CC ("strh"); OUTLONG(56); /* # of bytes to follow */ OUT4CC ("auds"); // ----------- // ThOe OUTLONG(0); /* Format (Optionally) */ // ----------- OUTLONG(0); /* Flags */ OUTLONG(0); /* Reserved, MS says: wPriority, wLanguage */ OUTLONG(0); /* InitialFrames */ // ThOe /4 OUTLONG(sampsize/4); /* Scale */ OUTLONG(1000*AVI->track[j].mp3rate/8); OUTLONG(0); /* Start */ OUTLONG(4*AVI->track[j].audio_bytes/sampsize); /* Length */ OUTLONG(0); /* SuggestedBufferSize */ OUTLONG(-1); /* Quality */ // ThOe /4 OUTLONG(sampsize/4); /* SampleSize */ OUTLONG(0); /* Frame */ OUTLONG(0); /* Frame */ // OUTLONG(0); /* Frame */ //OUTLONG(0); /* Frame */ /* The audio stream format */ OUT4CC ("strf"); OUTLONG(16); /* # of bytes to follow */ OUTSHRT(AVI->track[j].a_fmt); /* Format */ OUTSHRT(AVI->track[j].a_chans); /* Number of channels */ OUTLONG(AVI->track[j].a_rate); /* SamplesPerSec */ // ThOe OUTLONG(1000*AVI->track[j].mp3rate/8); //ThOe (/4) OUTSHRT(sampsize/4); /* BlockAlign */ OUTSHRT(AVI->track[j].a_bits); /* BitsPerSample */ /* Finish stream list, i.e. put number of bytes in the list to proper pos */ long2str(AVI_header+strl_start-4,nhb-strl_start); } /* Finish header list */ long2str(AVI_header+hdrl_start-4,nhb-hdrl_start); /* Calculate the needed amount of junk bytes, output junk */ njunk = HEADERBYTES - nhb - 8 - 12; /* Safety first: if njunk <= 0, somebody has played with HEADERBYTES without knowing what (s)he did. This is a fatal error */ if(njunk<=0) { fprintf(stderr,"AVI_close_output_file: # of header bytes too small\n"); exit(1); } OUT4CC ("JUNK"); OUTLONG(njunk); memset(AVI_header+nhb,0,njunk); nhb += njunk; /* Start the movi list */ OUT4CC ("LIST"); OUTLONG(movi_len); /* Length of list in bytes */ OUT4CC ("movi"); /* Output the header, truncate the file to the number of bytes actually written, report an error if someting goes wrong */ if ( xio_lseek(AVI->fdes,0,SEEK_SET)<0 || avi_write(AVI->fdes,(char *)AVI_header,HEADERBYTES)!=HEADERBYTES || xio_lseek(AVI->fdes,AVI->pos,SEEK_SET)<0) { AVI_errno = AVI_ERR_CLOSE; return -1; } return 0; } static int valid_info_tag(char *c) { if (!strncmp(c, "IARL", 4)) return 1; else if (!strncmp(c, "IART", 4)) return 1; else if (!strncmp(c, "ICMS", 4)) return 1; else if (!strncmp(c, "ICMT", 4)) return 1; else if (!strncmp(c, "ICOP", 4)) return 1; else if (!strncmp(c, "ICRD", 4)) return 1; else if (!strncmp(c, "ICRP", 4)) return 1; else if (!strncmp(c, "IDIM", 4)) return 1; else if (!strncmp(c, "IDPI", 4)) return 1; else if (!strncmp(c, "IENG", 4)) return 1; else if (!strncmp(c, "IGNR", 4)) return 1; else if (!strncmp(c, "IKEY", 4)) return 1; else if (!strncmp(c, "ILGT", 4)) return 1; else if (!strncmp(c, "IMED", 4)) return 1; else if (!strncmp(c, "INAM", 4)) return 1; else if (!strncmp(c, "IPLT", 4)) return 1; else if (!strncmp(c, "IPRD", 4)) return 1; else if (!strncmp(c, "ISBJ", 4)) return 1; else if (!strncmp(c, "ISHP", 4)) return 1; else if (!strncmp(c, "ISRC", 4)) return 1; else if (!strncmp(c, "ISRF", 4)) return 1; else if (!strncmp(c, "ITCH", 4)) return 1; else return 0; return 0; } // see ../docs/avi_comments.txt // returns the length of written stream (-1 on error) static int avi_parse_comments (int fd, char *buf, int space_left) { int len=0, readlen=0, k; char *data, *c, *d; struct stat st; // safety checks if (fd<=0 || !buf || space_left<=0) return -1; memset (buf, 0, space_left); if (fstat (fd, &st) == -1) { perror ("stat"); return -1; } if ( !(data = malloc(st.st_size*sizeof(char)+1)) ) { fprintf(stderr, "malloc failed\n"); return -1; } readlen = avi_read ( fd, data, st.st_size); //printf("Read %d bytes from %d\n", readlen, fd); c = data; space_left--; while (len < space_left) { if ( !c || *c == '\0') break; // eof; else if (*c == '#') { // comment, ignore c = strchr(c, '\n')+1; } else if (*c == '\n') { // empty, ignore c++; } else if (*c == 'I') { // do not write ISFT -- this is written by transcode // and important for debugging. if (!valid_info_tag(c)) { // skip this line while (c && *c && *c != '\n' ) { c++; } continue; } // set d after TAG d = c+4; // find first non-blank (!space or !TAB) while ( d && *d && (*d == ' ' || *d == ' ')) ++d; if (!d) break; // TAG without argument is fine but ignored if (*d == '\n' || *d == '\r') { c = d+1; if (*c == '\n') ++c; continue; } k = 0; while (d[k] != '\r' && d[k] != '\n' && d[k] != '\0') ++k; if (k>=space_left) return len; // write TAG memcpy(buf+len,c,4); len += 4; // write length + '\0' long2str(buf+len, k+1); len += 4; // write comment string memcpy (buf+len, d, k); // must be null terminated *(buf+len+k+1) = '\0'; // PAD if ((k+1)&1) { k++; *(buf+len+k+1) = '\0'; } len += k+1; // advance c while (*c != '\n' && *c != '\0') ++c; if (*c != '\0') ++c; else break; } else { // ignore junk lines while (c && *c && *c != '\n' ) { if (*c == ' ' || *c == ' ') { c++; break; } c++; } if (!c) break; } } free(data); return len; } //SLM #ifndef S_IRUSR #define S_IRWXU 00700 /* read, write, execute: owner */ #define S_IRUSR 00400 /* read permission: owner */ #define S_IWUSR 00200 /* write permission: owner */ #define S_IXUSR 00100 /* execute permission: owner */ #define S_IRWXG 00070 /* read, write, execute: group */ #define S_IRGRP 00040 /* read permission: group */ #define S_IWGRP 00020 /* write permission: group */ #define S_IXGRP 00010 /* execute permission: group */ #define S_IRWXO 00007 /* read, write, execute: other */ #define S_IROTH 00004 /* read permission: other */ #define S_IWOTH 00002 /* write permission: other */ #define S_IXOTH 00001 /* execute permission: other */ #endif /* Write the header of an AVI file and close it. returns 0 on success, -1 on write error. */ static int avi_close_output_file(avi_t *AVI) { int ret, njunk, sampsize, hasIndex, ms_per_frame, frate, idxerror, flag; unsigned long movi_len; int hdrl_start, strl_start, j; unsigned char AVI_header[HEADERBYTES]; long nhb; unsigned long xd_size, xd_size_align2; #ifdef INFO_LIST long info_len; long id_len, real_id_len; long info_start_pos; // time_t calptr; #endif /* Calculate length of movi list */ // dump the rest of the index if (AVI->is_opendml) { int cur_std_idx = AVI->video_superindex->nEntriesInUse-1; int audtr; #ifdef DEBUG_ODML printf("ODML dump the rest indices\n"); #endif avi_ixnn_entry (AVI, AVI->video_superindex->stdindex[cur_std_idx], &AVI->video_superindex->aIndex[cur_std_idx]); AVI->video_superindex->aIndex[cur_std_idx].dwDuration = AVI->video_superindex->stdindex[cur_std_idx]->nEntriesInUse - 1; for (audtr = 0; audtr < AVI->anum; audtr++) { if (!AVI->track[audtr].audio_superindex) { // not initialized -> no index continue; } avi_ixnn_entry (AVI, AVI->track[audtr].audio_superindex->stdindex[cur_std_idx], &AVI->track[audtr].audio_superindex->aIndex[cur_std_idx]); AVI->track[audtr].audio_superindex->aIndex[cur_std_idx].dwDuration = AVI->track[audtr].audio_superindex->stdindex[cur_std_idx]->nEntriesInUse - 1; if (AVI->track[audtr].a_fmt == 0x1) { AVI->track[audtr].audio_superindex->aIndex[cur_std_idx].dwDuration *= AVI->track[audtr].a_bits*AVI->track[audtr].a_rate*AVI->track[audtr].a_chans/800; } } // The AVI->video_superindex->nEntriesInUse contains the offset AVI->video_superindex->stdindex[ cur_std_idx+1 ]->qwBaseOffset = AVI->pos; } if (AVI->is_opendml) { // Correct! movi_len = AVI->video_superindex->stdindex[ 1 ]->qwBaseOffset - HEADERBYTES+4 - AVI->n_idx*16 - 8; } else { movi_len = AVI->pos - HEADERBYTES + 4; } /* Try to ouput the index entries. This may fail e.g. if no space is left on device. We will report this as an error, but we still try to write the header correctly (so that the file still may be readable in the most cases */ idxerror = 0; hasIndex = 1; if (!AVI->is_opendml) { // fprintf(stderr, "pos=%lu, index_len=%ld \n", AVI->pos, AVI->n_idx*16); ret = avi_add_chunk(AVI, (unsigned char *)"idx1", (unsigned char *)AVI->idx, AVI->n_idx*16); hasIndex = (ret==0); //fprintf(stderr, "pos=%lu, index_len=%d\n", AVI->pos, hasIndex); if(ret) { idxerror = 1; AVI_errno = AVI_ERR_WRITE_INDEX; } } /* Calculate Microseconds per frame */ if(AVI->fps < 0.001) { frate=0; ms_per_frame=0; } else { frate = (int) (FRAME_RATE_SCALE*AVI->fps + 0.5); ms_per_frame=(int) (1000000/AVI->fps + 0.5); } /* Prepare the file header */ nhb = 0; /* The RIFF header */ OUT4CC ("RIFF"); if (AVI->is_opendml) { OUTLONG(AVI->video_superindex->stdindex[ 1 ]->qwBaseOffset - 8); /* # of bytes to follow */ } else { OUTLONG(AVI->pos - 8); /* # of bytes to follow */ } OUT4CC ("AVI "); /* Start the header list */ OUT4CC ("LIST"); OUTLONG(0); /* Length of list in bytes, don't know yet */ hdrl_start = nhb; /* Store start position */ OUT4CC ("hdrl"); /* The main AVI header */ /* The Flags in AVI File header */ #define AVIF_HASINDEX 0x00000010 /* Index at end of file */ #define AVIF_MUSTUSEINDEX 0x00000020 #define AVIF_ISINTERLEAVED 0x00000100 #define AVIF_TRUSTCKTYPE 0x00000800 /* Use CKType to find key frames */ #define AVIF_WASCAPTUREFILE 0x00010000 #define AVIF_COPYRIGHTED 0x00020000 OUT4CC ("avih"); OUTLONG(56); /* # of bytes to follow */ OUTLONG(ms_per_frame); /* Microseconds per frame */ //ThOe ->0 // OUTLONG(10000000); /* MaxBytesPerSec, I hope this will never be used */ OUTLONG(0); OUTLONG(0); /* PaddingGranularity (whatever that might be) */ /* Other sources call it 'reserved' */ flag = AVIF_ISINTERLEAVED; if(hasIndex) flag |= AVIF_HASINDEX; if(hasIndex && AVI->must_use_index) flag |= AVIF_MUSTUSEINDEX; OUTLONG(flag); /* Flags */ OUTLONG(AVI->video_frames); /* TotalFrames */ OUTLONG(0); /* InitialFrames */ OUTLONG(AVI->anum+1); // if (AVI->track[0].audio_bytes) // { OUTLONG(2); } /* Streams */ // else // { OUTLONG(1); } /* Streams */ OUTLONG(0); /* SuggestedBufferSize */ OUTLONG(AVI->width); /* Width */ OUTLONG(AVI->height); /* Height */ /* MS calls the following 'reserved': */ OUTLONG(0); /* TimeScale: Unit used to measure time */ OUTLONG(0); /* DataRate: Data rate of playback */ OUTLONG(0); /* StartTime: Starting time of AVI data */ OUTLONG(0); /* DataLength: Size of AVI data chunk */ /* Start the video stream list ---------------------------------- */ OUT4CC ("LIST"); OUTLONG(0); /* Length of list in bytes, don't know yet */ strl_start = nhb; /* Store start position */ OUT4CC ("strl"); /* The video stream header */ OUT4CC ("strh"); OUTLONG(56); /* # of bytes to follow */ OUT4CC ("vids"); /* Type */ OUT4CC (AVI->compressor); /* Handler */ OUTLONG(0); /* Flags */ OUTLONG(0); /* Reserved, MS says: wPriority, wLanguage */ OUTLONG(0); /* InitialFrames */ OUTLONG(FRAME_RATE_SCALE); /* Scale */ OUTLONG(frate); /* Rate: Rate/Scale == samples/second */ OUTLONG(0); /* Start */ OUTLONG(AVI->video_frames); /* Length */ OUTLONG(AVI->max_len); /* SuggestedBufferSize */ OUTLONG(0); /* Quality */ OUTLONG(0); /* SampleSize */ OUTLONG(0); /* Frame */ OUTLONG(0); /* Frame */ //OUTLONG(0); /* Frame */ //OUTLONG(0); /* Frame */ /* The video stream format */ xd_size = AVI->extradata_size; xd_size_align2 = (AVI->extradata_size+1) & ~1; OUT4CC ("strf"); OUTLONG(40 + xd_size_align2);/* # of bytes to follow */ OUTLONG(40 + xd_size); /* Size */ OUTLONG(AVI->width); /* Width */ OUTLONG(AVI->height); /* Height */ OUTSHRT(1); OUTSHRT(24); /* Planes, Count */ OUT4CC (AVI->compressor); /* Compression */ // ThOe (*3) OUTLONG(AVI->width*AVI->height*3); /* SizeImage (in bytes?) */ OUTLONG(0); /* XPelsPerMeter */ OUTLONG(0); /* YPelsPerMeter */ OUTLONG(0); /* ClrUsed: Number of colors used */ OUTLONG(0); /* ClrImportant: Number of colors important */ // write extradata if present if (xd_size > 0 && AVI->extradata) { OUTMEM(AVI->extradata, xd_size); if (xd_size != xd_size_align2) { OUTCHR(0); } } // dump index of indices for audio if (AVI->is_opendml) { int k; OUT4CC(AVI->video_superindex->fcc); OUTLONG(2+1+1+4+4+3*4 + AVI->video_superindex->nEntriesInUse * (8+4+4)); OUTSHRT(AVI->video_superindex->wLongsPerEntry); OUTCHR(AVI->video_superindex->bIndexSubType); OUTCHR(AVI->video_superindex->bIndexType); OUTLONG(AVI->video_superindex->nEntriesInUse); OUT4CC(AVI->video_superindex->dwChunkId); OUTLONG(0); OUTLONG(0); OUTLONG(0); for (k = 0; k < AVI->video_superindex->nEntriesInUse; k++) { uint32_t r = (AVI->video_superindex->aIndex[k].qwOffset >> 32) & 0xffffffff; uint32_t s = (AVI->video_superindex->aIndex[k].qwOffset) & 0xffffffff; printf("VID NrEntries %d/%ld (%c%c%c%c) |0x%llX|%ld|%ld|\n", k, (unsigned long)AVI->video_superindex->nEntriesInUse, AVI->video_superindex->dwChunkId[0], AVI->video_superindex->dwChunkId[1], AVI->video_superindex->dwChunkId[2], AVI->video_superindex->dwChunkId[3], (unsigned long long)AVI->video_superindex->aIndex[k].qwOffset, (unsigned long)AVI->video_superindex->aIndex[k].dwSize, (unsigned long)AVI->video_superindex->aIndex[k].dwDuration ); /* */ OUTLONG(s); OUTLONG(r); OUTLONG(AVI->video_superindex->aIndex[k].dwSize); OUTLONG(AVI->video_superindex->aIndex[k].dwDuration); } } /* Finish stream list, i.e. put number of bytes in the list to proper pos */ long2str(AVI_header+strl_start-4,nhb-strl_start); /* Start the audio stream list ---------------------------------- */ for(j=0; janum; ++j) { //if (AVI->track[j].a_chans && AVI->track[j].audio_bytes) { unsigned long nBlockAlign = 0; unsigned long avgbsec = 0; unsigned long scalerate = 0; sampsize = avi_sampsize(AVI, j); sampsize = AVI->track[j].a_fmt==0x1?sampsize*4:sampsize; nBlockAlign = (AVI->track[j].a_rate<32000)?576:1152; /* printf("XXX sampsize (%d) block (%ld) rate (%ld) audio_bytes (%ld) mp3rate(%ld,%ld)\n", sampsize, nBlockAlign, AVI->track[j].a_rate, (long int)AVI->track[j].audio_bytes, 1000*AVI->track[j].mp3rate/8, AVI->track[j].mp3rate); */ if (AVI->track[j].a_fmt==0x1) { sampsize = (AVI->track[j].a_chans<2)?sampsize/2:sampsize; avgbsec = AVI->track[j].a_rate*sampsize/4; scalerate = AVI->track[j].a_rate*sampsize/4; } else { avgbsec = 1000*AVI->track[j].mp3rate/8; scalerate = 1000*AVI->track[j].mp3rate/8; } OUT4CC ("LIST"); OUTLONG(0); /* Length of list in bytes, don't know yet */ strl_start = nhb; /* Store start position */ OUT4CC ("strl"); /* The audio stream header */ OUT4CC ("strh"); OUTLONG(56); /* # of bytes to follow */ OUT4CC ("auds"); // ----------- // ThOe OUTLONG(0); /* Format (Optionally) */ // ----------- OUTLONG(0); /* Flags */ OUTLONG(0); /* Reserved, MS says: wPriority, wLanguage */ OUTLONG(0); /* InitialFrames */ // VBR if (AVI->track[j].a_fmt == 0x55 && AVI->track[j].a_vbr) { OUTLONG(nBlockAlign); /* Scale */ OUTLONG(AVI->track[j].a_rate); /* Rate */ OUTLONG(0); /* Start */ OUTLONG(AVI->track[j].audio_chunks); /* Length */ OUTLONG(0); /* SuggestedBufferSize */ OUTLONG(0); /* Quality */ OUTLONG(0); /* SampleSize */ OUTLONG(0); /* Frame */ OUTLONG(0); /* Frame */ } else { OUTLONG(sampsize/4); /* Scale */ OUTLONG(scalerate); /* Rate */ OUTLONG(0); /* Start */ OUTLONG(4*AVI->track[j].audio_bytes/sampsize); /* Length */ OUTLONG(0); /* SuggestedBufferSize */ OUTLONG(0xffffffff); /* Quality */ OUTLONG(sampsize/4); /* SampleSize */ OUTLONG(0); /* Frame */ OUTLONG(0); /* Frame */ } /* The audio stream format */ OUT4CC ("strf"); if (AVI->track[j].a_fmt == 0x55 && AVI->track[j].a_vbr) { OUTLONG(30); /* # of bytes to follow */ // mplayer writes 28 OUTSHRT(AVI->track[j].a_fmt); /* Format */ // 2 OUTSHRT(AVI->track[j].a_chans); /* Number of channels */ // 2 OUTLONG(AVI->track[j].a_rate); /* SamplesPerSec */ // 4 //ThOe/tibit OUTLONG(1000*AVI->track[j].mp3rate/8); /* maybe we should write an avg. */ // 4 OUTSHRT(nBlockAlign); /* BlockAlign */ // 2 OUTSHRT(AVI->track[j].a_bits); /* BitsPerSample */ // 2 OUTSHRT(12); /* cbSize */ // 2 OUTSHRT(1); /* wID */ // 2 OUTLONG(2); /* fdwFlags */ // 4 OUTSHRT(nBlockAlign); /* nBlockSize */ // 2 OUTSHRT(1); /* nFramesPerBlock */ // 2 OUTSHRT(0); /* nCodecDelay */ // 2 } else if (AVI->track[j].a_fmt == 0x55 && !AVI->track[j].a_vbr) { OUTLONG(30); /* # of bytes to follow */ OUTSHRT(AVI->track[j].a_fmt); /* Format */ OUTSHRT(AVI->track[j].a_chans); /* Number of channels */ OUTLONG(AVI->track[j].a_rate); /* SamplesPerSec */ //ThOe/tibit OUTLONG(1000*AVI->track[j].mp3rate/8); OUTSHRT(sampsize/4); /* BlockAlign */ OUTSHRT(AVI->track[j].a_bits); /* BitsPerSample */ OUTSHRT(12); /* cbSize */ OUTSHRT(1); /* wID */ OUTLONG(2); /* fdwFlags */ OUTSHRT(nBlockAlign); /* nBlockSize */ OUTSHRT(1); /* nFramesPerBlock */ OUTSHRT(0); /* nCodecDelay */ } else { OUTLONG(18); /* # of bytes to follow */ OUTSHRT(AVI->track[j].a_fmt); /* Format */ OUTSHRT(AVI->track[j].a_chans); /* Number of channels */ OUTLONG(AVI->track[j].a_rate); /* SamplesPerSec */ //ThOe/tibit OUTLONG(avgbsec); /* Avg bytes/sec */ OUTSHRT(sampsize/4); /* BlockAlign */ OUTSHRT(AVI->track[j].a_bits); /* BitsPerSample */ OUTSHRT(0); /* cbSize */ } } if (AVI->is_opendml) { int k ; if (!AVI->track[j].audio_superindex) { // not initialized -> no index continue; } OUT4CC(AVI->track[j].audio_superindex->fcc); /* "indx" */ OUTLONG(2+1+1+4+4+3*4 + AVI->track[j].audio_superindex->nEntriesInUse * (8+4+4)); OUTSHRT(AVI->track[j].audio_superindex->wLongsPerEntry); OUTCHR(AVI->track[j].audio_superindex->bIndexSubType); OUTCHR(AVI->track[j].audio_superindex->bIndexType); OUTLONG(AVI->track[j].audio_superindex->nEntriesInUse); OUT4CC(AVI->track[j].audio_superindex->dwChunkId); OUTLONG(0); OUTLONG(0); OUTLONG(0); for (k = 0; k < AVI->track[j].audio_superindex->nEntriesInUse; k++) { uint32_t r = (AVI->track[j].audio_superindex->aIndex[k].qwOffset >> 32) & 0xffffffff; uint32_t s = (AVI->track[j].audio_superindex->aIndex[k].qwOffset) & 0xffffffff; /* printf("AUD[%d] NrEntries %d/%ld (%c%c%c%c) |0x%llX|%ld|%ld| \n", j, k, AVI->track[j].audio_superindex->nEntriesInUse, AVI->track[j].audio_superindex->dwChunkId[0], AVI->track[j].audio_superindex->dwChunkId[1], AVI->track[j].audio_superindex->dwChunkId[2], AVI->track[j].audio_superindex->dwChunkId[3], AVI->track[j].audio_superindex->aIndex[k].qwOffset, AVI->track[j].audio_superindex->aIndex[k].dwSize, AVI->track[j].audio_superindex->aIndex[k].dwDuration ); */ OUTLONG(s); OUTLONG(r); OUTLONG(AVI->track[j].audio_superindex->aIndex[k].dwSize); OUTLONG(AVI->track[j].audio_superindex->aIndex[k].dwDuration); } } /* Finish stream list, i.e. put number of bytes in the list to proper pos */ long2str(AVI_header+strl_start-4,nhb-strl_start); } if (AVI->is_opendml) { OUT4CC("LIST"); OUTLONG(16); OUT4CC("odml"); OUT4CC("dmlh"); OUTLONG(4); OUTLONG(AVI->total_frames); } /* Finish header list */ long2str(AVI_header+hdrl_start-4,nhb-hdrl_start); // add INFO list --- (0.6.0pre4) #ifdef INFO_LIST OUT4CC ("LIST"); info_start_pos = nhb; info_len = MAX_INFO_STRLEN + 12; OUTLONG(info_len); // rewritten later OUT4CC ("INFO"); OUT4CC ("ISFT"); //OUTLONG(MAX_INFO_STRLEN); memset(id_str, 0, MAX_INFO_STRLEN); sprintf(id_str, "%s-%s", PACKAGE, VERSION); real_id_len = id_len = strlen(id_str)+1; if (id_len&1) id_len++; OUTLONG(real_id_len); memset(AVI_header+nhb, 0, id_len); memcpy(AVI_header+nhb, id_str, id_len); nhb += id_len; info_len = avi_parse_comments (AVI->comment_fd, AVI_header+nhb, HEADERBYTES - nhb - 8 - 12); if (info_len <= 0) info_len=0; // write correct len long2str(AVI_header+info_start_pos, info_len + id_len + 4+4+4); nhb += info_len; // OUT4CC ("ICMT"); // OUTLONG(MAX_INFO_STRLEN); // calptr=time(NULL); // sprintf(id_str, "\t%s %s", ctime(&calptr), ""); // memset(AVI_header+nhb, 0, MAX_INFO_STRLEN); // memcpy(AVI_header+nhb, id_str, 25); // nhb += MAX_INFO_STRLEN; #endif // ---------------------------- /* Calculate the needed amount of junk bytes, output junk */ njunk = HEADERBYTES - nhb - 8 - 12; /* Safety first: if njunk <= 0, somebody has played with HEADERBYTES without knowing what (s)he did. This is a fatal error */ if(njunk<=0) { fprintf(stderr,"AVI_close_output_file: # of header bytes too small\n"); exit(1); } OUT4CC ("JUNK"); OUTLONG(njunk); memset(AVI_header+nhb,0,njunk); nhb += njunk; /* Start the movi list */ OUT4CC ("LIST"); OUTLONG(movi_len); /* Length of list in bytes */ OUT4CC ("movi"); /* Output the header, truncate the file to the number of bytes actually written, report an error if someting goes wrong */ if ( xio_lseek(AVI->fdes,0,SEEK_SET)<0 || avi_write(AVI->fdes,(char *)AVI_header,HEADERBYTES)!=HEADERBYTES || xio_ftruncate(AVI->fdes,AVI->pos)<0 ) { AVI_errno = AVI_ERR_CLOSE; return -1; } // Fix up the empty additional RIFF and LIST chunks if (AVI->is_opendml) { int k = 0; char f[4]; unsigned int len; for (k=1; kvideo_superindex->nEntriesInUse; k++) { // the len of the RIFF Chunk xio_lseek(AVI->fdes, AVI->video_superindex->stdindex[k]->qwBaseOffset+4, SEEK_SET); len = AVI->video_superindex->stdindex[k+1]->qwBaseOffset - AVI->video_superindex->stdindex[k]->qwBaseOffset - 8; long2str(f, len); avi_write(AVI->fdes, f, 4); // len of the LIST/movi chunk xio_lseek(AVI->fdes, 8, SEEK_CUR); len -= 12; long2str(f, len); avi_write(AVI->fdes, f, 4); } } if(idxerror) return -1; return 0; } /* AVI_write_data: Add video or audio data to the file; Return values: 0 No error; -1 Error, AVI_errno is set appropriatly; */ static int avi_write_data(avi_t *AVI, char *data, unsigned long length, int audio, int keyframe) { int n = 0; unsigned char astr[5]; // transcode core itself checks for the size -- unneeded and // does harm to xvid 2pass encodes where the first pass can get // _very_ large -- tibit. #if 0 /* Check for maximum file length */ if ( (AVI->pos + 8 + length + 8 + (AVI->n_idx+1)*16) > AVI_MAX_LEN ) { AVI_errno = AVI_ERR_SIZELIM; return -1; } #endif /* Add index entry */ //set tag for current audio track sprintf((char *)astr, "0%1dwb", (int)(AVI->aptr+1)); if(audio) { if (!AVI->is_opendml) n = avi_add_index_entry(AVI,astr,0x10,AVI->pos,length); n += avi_add_odml_index_entry(AVI,astr,0x10,AVI->pos,length); } else { if (!AVI->is_opendml) n = avi_add_index_entry(AVI,(unsigned char *)"00db",((keyframe)?0x10:0x0),AVI->pos,length); n += avi_add_odml_index_entry(AVI,(unsigned char *)"00db",((keyframe)?0x10:0x0),AVI->pos,length); } if(n) return -1; /* Output tag and data */ if(audio) n = avi_add_chunk(AVI,(unsigned char *)astr,data,length); else n = avi_add_chunk(AVI,(unsigned char *)"00db",data,length); if (n) return -1; return 0; } int AVI_write_frame(avi_t *AVI, char *data, long bytes, int keyframe) { int64_t pos; if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } pos = AVI->pos; if(avi_write_data(AVI,data,bytes,0,keyframe)) return -1; AVI->last_pos = pos; AVI->last_len = bytes; AVI->video_frames++; return 0; } int AVI_dup_frame(avi_t *AVI) { if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(AVI->last_pos==0) return 0; /* No previous real frame */ if(avi_add_index_entry(AVI,(unsigned char *)"00db",0x10,AVI->last_pos,AVI->last_len)) return -1; AVI->video_frames++; AVI->must_use_index = 1; return 0; } int AVI_write_audio(avi_t *AVI, char *data, long bytes) { if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if( avi_write_data(AVI,data,bytes,1,0) ) return -1; AVI->track[AVI->aptr].audio_bytes += bytes; AVI->track[AVI->aptr].audio_chunks++; return 0; } int AVI_append_audio(avi_t *AVI, char *data, long bytes) { // won't work for >2gb long i, length, pos; unsigned char c[4]; if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } // update last index entry: --AVI->n_idx; length = str2ulong(AVI->idx[AVI->n_idx]+12); pos = str2ulong(AVI->idx[AVI->n_idx]+8); //update; long2str(AVI->idx[AVI->n_idx]+12,length+bytes); ++AVI->n_idx; AVI->track[AVI->aptr].audio_bytes += bytes; //update chunk header xio_lseek(AVI->fdes, pos+4, SEEK_SET); long2str(c, length+bytes); avi_write(AVI->fdes, (char *)c, 4); xio_lseek(AVI->fdes, pos+8+length, SEEK_SET); i=PAD_EVEN(length + bytes); bytes = i - length; avi_write(AVI->fdes, data, bytes); AVI->pos = pos + 8 + i; return 0; } long AVI_bytes_remain(avi_t *AVI) { if(AVI->mode==AVI_MODE_READ) return 0; return ( AVI_MAX_LEN - (AVI->pos + 8 + 16*AVI->n_idx)); } long AVI_bytes_written(avi_t *AVI) { if(AVI->mode==AVI_MODE_READ) return 0; return (AVI->pos + 8 + 16*AVI->n_idx); } int AVI_set_audio_track(avi_t *AVI, int track) { if(track < 0 || track + 1 > AVI->anum) return(-1); //this info is not written to file anyway AVI->aptr=track; return 0; } int AVI_get_audio_track(avi_t *AVI) { return(AVI->aptr); } void AVI_set_audio_vbr(avi_t *AVI, long is_vbr) { AVI->track[AVI->aptr].a_vbr = is_vbr; } long AVI_get_audio_vbr(avi_t *AVI) { return(AVI->track[AVI->aptr].a_vbr); } void AVI_set_comment_fd(avi_t *AVI, int fd) { AVI->comment_fd = fd; } int AVI_get_comment_fd(avi_t *AVI) { return AVI->comment_fd; } /******************************************************************* * * * Utilities for reading video and audio from an AVI File * * * *******************************************************************/ int AVI_close(avi_t *AVI) { int ret; int j; /* If the file was open for writing, the header and index still have to be written */ if(AVI->mode == AVI_MODE_WRITE) ret = avi_close_output_file(AVI); else ret = 0; /* Even if there happened an error, we first clean up */ if (AVI->comment_fd>0) xio_close(AVI->comment_fd); AVI->comment_fd = -1; xio_close(AVI->fdes); if(AVI->idx) free(AVI->idx); if(AVI->video_index) free(AVI->video_index); if(AVI->video_superindex) { if(AVI->video_superindex->aIndex) free(AVI->video_superindex->aIndex); free(AVI->video_superindex); } for (j=0; janum; j++) { if(AVI->track[j].audio_index) free(AVI->track[j].audio_index); if(AVI->track[j].audio_superindex) { if(AVI->track[j].audio_superindex->aIndex) free(AVI->track[j].audio_superindex->aIndex); free(AVI->track[j].audio_superindex); } } if (AVI->bitmap_info_header) free(AVI->bitmap_info_header); for (j = 0; j < AVI->anum; j++) if (AVI->wave_format_ex[j]) free(AVI->wave_format_ex[j]); free(AVI); AVI=NULL; return ret; } #define ERR_EXIT(x) \ { \ AVI_close(AVI); \ AVI_errno = x; \ return 0; \ } avi_t *AVI_open_input_indexfile(char *filename, int getIndex, char *indexfile) { avi_t *AVI=NULL; /* Create avi_t structure */ AVI = (avi_t *) malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ /* Open the file */ #if defined(SYS_WINDOWS) AVI->fdes = open(filename,O_RDONLY|O_BINARY); #else AVI->fdes = xio_open(filename,O_RDONLY); #endif if(AVI->fdes < 0) { AVI_errno = AVI_ERR_OPEN; free(AVI); return 0; } AVI->index_file=strdup(indexfile); AVI_errno = 0; avi_parse_input_file(AVI, getIndex); if (AVI != NULL && !AVI_errno) { AVI->aptr=0; //reset } if (AVI_errno) return AVI=NULL; else return AVI; } avi_t *AVI_open_indexfd(int fd, int getIndex, char *indexfile) { avi_t *AVI=NULL; /* Create avi_t structure */ AVI = (avi_t *) malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ // file alread open AVI->fdes = fd; AVI->index_file=strdup(indexfile); AVI_errno = 0; avi_parse_input_file(AVI, getIndex); if (AVI != NULL && !AVI_errno) { AVI->aptr=0; //reset } if (AVI_errno) return AVI=NULL; else return AVI; } avi_t *AVI_open_input_file(char *filename, int getIndex) { avi_t *AVI=NULL; /* Create avi_t structure */ AVI = (avi_t *) malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ /* Open the file */ AVI->fdes = xio_open(filename,O_RDONLY); if(AVI->fdes < 0) { AVI_errno = AVI_ERR_OPEN; free(AVI); return 0; } AVI_errno = 0; avi_parse_input_file(AVI, getIndex); if (AVI != NULL && !AVI_errno) { AVI->aptr=0; //reset } if (AVI_errno) return AVI=NULL; else return AVI; } avi_t *AVI_open_fd(int fd, int getIndex) { avi_t *AVI=NULL; /* Create avi_t structure */ AVI = (avi_t *) malloc(sizeof(avi_t)); if(AVI==NULL) { AVI_errno = AVI_ERR_NO_MEM; return 0; } memset((void *)AVI,0,sizeof(avi_t)); AVI->mode = AVI_MODE_READ; /* open for reading */ // file alread open AVI->fdes = fd; AVI_errno = 0; avi_parse_input_file(AVI, getIndex); if (AVI != NULL && !AVI_errno) { AVI->aptr=0; //reset } if (AVI_errno) return AVI=NULL; else return AVI; } // transcode-0.6.8 // reads a file generated by aviindex and builds the index out of it. int avi_parse_index_from_file(avi_t *AVI, char *filename) { char data[100]; // line buffer FILE *fd = NULL; // read from int64_t pos, len, f_pos, tot_chunks[AVI_MAX_TRACKS]; int key=0, type; int vid_chunks=0, aud_chunks[AVI_MAX_TRACKS]; long line_count=0; char *c, d; int i,j; for (i=0; ivideo_index) { free(AVI->video_index); AVI->video_index = NULL; } for(j=0; janum; ++j) { if(AVI->track[j].audio_index) { free(AVI->track[j].audio_index); } AVI->track[j].audio_index = NULL; AVI->track[j].audio_chunks = 0; } if (!(fd = fopen(filename, "r"))) { perror ("avi_parse_index_from_file: fopen"); return -1; } // read header fgets(data, 100, fd); if ( strncasecmp(data, "AVIIDX1", 7) != 0) { fprintf(stderr, "%s: Not an AVI index file\n", filename); return -1; } // read comment fgets(data, 100, fd); f_pos = ftell(fd); while (fgets(data, 100, fd)) { d = data[5] - '1'; if (d == 0) { vid_chunks++; } else if (d == 1 || d == 2 || d == 3 || d == 4 || d == 5 || d == 6 || d == 7 || d == 8 ) { aud_chunks[d-1]++; } else continue; line_count++; } AVI->video_frames = vid_chunks; for(j=0; janum; ++j) AVI->track[j].audio_chunks = aud_chunks[j]; if(AVI->video_frames==0) ERR_EXIT(AVI_ERR_NO_VIDS); AVI->video_index = (video_index_entry *) malloc(vid_chunks*sizeof(video_index_entry)); if(AVI->video_index==0) ERR_EXIT(AVI_ERR_NO_MEM); for(j=0; janum; ++j) { if(AVI->track[j].audio_chunks) { AVI->track[j].audio_index = (audio_index_entry *) malloc(aud_chunks[j]*sizeof(audio_index_entry)); if(AVI->track[j].audio_index==0) ERR_EXIT(AVI_ERR_NO_MEM); } } // reset after header fseek(fd, f_pos, SEEK_SET); vid_chunks = 0; for(j=0; janum; ++j) aud_chunks[j] = tot_chunks[j] = 0; while (fgets(data, 100, fd)) { // this is very slow // sscanf(data, "%*s %d %*d %*d %lld %lld %d %*f", &type, &pos, &len, &key); c = strchr (data, ' '); type = strtol(c+1, &c, 10); //ch = strtol(c+1, &c, 10); c = strchr(c+1, ' '); //chtype= strtol(c+1, &c, 10); c = strchr(c+1, ' '); pos = strtoll(c+1, &c, 10); len = strtol(c+1, &c, 10); key = strtol(c+1, &c, 10); //ms = strtod(c+1, NULL); i = type-1; switch (i) { case 0: // video AVI->video_index[vid_chunks].key = (int64_t)(key?0x10:0); AVI->video_index[vid_chunks].pos = pos+8; AVI->video_index[vid_chunks].len = len; vid_chunks++; break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: j=i-1; AVI->track[j].audio_index[aud_chunks[j]].pos = pos+8; AVI->track[j].audio_index[aud_chunks[j]].len = len; AVI->track[j].audio_index[aud_chunks[j]].tot = tot_chunks[j]; tot_chunks[j] += AVI->track[j].audio_index[aud_chunks[j]].len; aud_chunks[j]++; break; default: continue; } } for(j=0; janum; ++j) AVI->track[j].audio_bytes = tot_chunks[j]; fclose (fd); return 0; } int avi_parse_input_file(avi_t *AVI, int getIndex) { long i, rate, scale, idx_type; int64_t n; unsigned char *hdrl_data; long header_offset=0, hdrl_len=0; long nvi, nai[AVI_MAX_TRACKS], ioff; long tot[AVI_MAX_TRACKS]; int j; int lasttag = 0; int vids_strh_seen = 0; int vids_strf_seen = 0; int auds_strh_seen = 0; // int auds_strf_seen = 0; int num_stream = 0; char data[256]; int64_t oldpos=-1, newpos=-1; /* Read first 12 bytes and check that this is an AVI file */ if( avi_read(AVI->fdes,data,12) != 12 ) ERR_EXIT(AVI_ERR_READ) if( strncasecmp(data ,"RIFF",4) !=0 || strncasecmp(data+8,"AVI ",4) !=0 ) ERR_EXIT(AVI_ERR_NO_AVI) /* Go through the AVI file and extract the header list, the start position of the 'movi' list and an optionally present idx1 tag */ hdrl_data = 0; while(1) { if( avi_read(AVI->fdes,data,8) != 8 ) break; /* We assume it's EOF */ newpos=xio_lseek(AVI->fdes,0,SEEK_CUR); if(oldpos==newpos) { /* This is a broken AVI stream... */ return -1; } oldpos=newpos; n = str2ulong((unsigned char *)data+4); n = PAD_EVEN(n); if(strncasecmp(data,"LIST",4) == 0) { if( avi_read(AVI->fdes,data,4) != 4 ) ERR_EXIT(AVI_ERR_READ) n -= 4; if(strncasecmp(data,"hdrl",4) == 0) { hdrl_len = n; hdrl_data = (unsigned char *) malloc(n); if(hdrl_data==0) ERR_EXIT(AVI_ERR_NO_MEM); // offset of header header_offset = xio_lseek(AVI->fdes,0,SEEK_CUR); if( avi_read(AVI->fdes,(char *)hdrl_data,n) != n ) ERR_EXIT(AVI_ERR_READ) } else if(strncasecmp(data,"movi",4) == 0) { AVI->movi_start = xio_lseek(AVI->fdes,0,SEEK_CUR); if (xio_lseek(AVI->fdes,n,SEEK_CUR)==(int64_t)-1) break; } else if (xio_lseek(AVI->fdes,n,SEEK_CUR)==(int64_t)-1) break; } else if(strncasecmp(data,"idx1",4) == 0) { /* n must be a multiple of 16, but the reading does not break if this is not the case */ AVI->n_idx = AVI->max_idx = n/16; AVI->idx = (unsigned char((*)[16]) ) malloc(n); if(AVI->idx==0) ERR_EXIT(AVI_ERR_NO_MEM) if(avi_read(AVI->fdes, (char *) AVI->idx, n) != n ) { free ( AVI->idx); AVI->idx=NULL; AVI->n_idx = 0; } } else xio_lseek(AVI->fdes,n,SEEK_CUR); } if(!hdrl_data ) ERR_EXIT(AVI_ERR_NO_HDRL) if(!AVI->movi_start) ERR_EXIT(AVI_ERR_NO_MOVI) /* Interpret the header list */ for(i=0;icompressor,hdrl_data+i+4,4); AVI->compressor[4] = 0; // ThOe AVI->v_codech_off = header_offset + i+4; scale = str2ulong(hdrl_data+i+20); rate = str2ulong(hdrl_data+i+24); if(scale!=0) AVI->fps = (double)rate/(double)scale; AVI->video_frames = str2ulong(hdrl_data+i+32); AVI->video_strn = num_stream; AVI->max_len = 0; vids_strh_seen = 1; lasttag = 1; /* vids */ memcpy(&AVI->video_stream_header, hdrl_data + i, sizeof(alAVISTREAMHEADER)); } else if (strncasecmp ((char *)hdrl_data+i,"auds",4) ==0 && ! auds_strh_seen) { //inc audio tracks AVI->aptr=AVI->anum; ++AVI->anum; if(AVI->anum > AVI_MAX_TRACKS) { fprintf(stderr, "error - only %d audio tracks supported\n", AVI_MAX_TRACKS); return(-1); } AVI->track[AVI->aptr].audio_bytes = str2ulong(hdrl_data+i+32)*avi_sampsize(AVI, 0); AVI->track[AVI->aptr].audio_strn = num_stream; // if samplesize==0 -> vbr AVI->track[AVI->aptr].a_vbr = !str2ulong(hdrl_data+i+44); AVI->track[AVI->aptr].padrate = str2ulong(hdrl_data+i+24); memcpy(&AVI->stream_headers[AVI->aptr], hdrl_data + i, sizeof(alAVISTREAMHEADER)); // auds_strh_seen = 1; lasttag = 2; /* auds */ // ThOe AVI->track[AVI->aptr].a_codech_off = header_offset + i; } else if (strncasecmp (hdrl_data+i,"iavs",4) ==0 && ! auds_strh_seen) { fprintf(stderr, "AVILIB: error - DV AVI Type 1 no supported\n"); return (-1); } else lasttag = 0; num_stream++; } else if(strncasecmp(hdrl_data+i,"dmlh",4) == 0) { AVI->total_frames = str2ulong(hdrl_data+i+8); #ifdef DEBUG_ODML fprintf(stderr, "real number of frames %d\n", AVI->total_frames); #endif i += 8; } else if(strncasecmp((char *)hdrl_data+i,"strf",4)==0) { i += 8; if(lasttag == 1) { alBITMAPINFOHEADER bih; memcpy(&bih, hdrl_data + i, sizeof(alBITMAPINFOHEADER)); AVI->bitmap_info_header = (alBITMAPINFOHEADER *) malloc(str2ulong((unsigned char *)&bih.bi_size)); if (AVI->bitmap_info_header != NULL) memcpy(AVI->bitmap_info_header, hdrl_data + i, str2ulong((unsigned char *)&bih.bi_size)); AVI->width = str2ulong(hdrl_data+i+4); AVI->height = str2ulong(hdrl_data+i+8); vids_strf_seen = 1; //ThOe AVI->v_codecf_off = header_offset + i+16; memcpy(AVI->compressor2, hdrl_data+i+16, 4); AVI->compressor2[4] = 0; } else if(lasttag == 2) { alWAVEFORMATEX *wfe; char *nwfe; int wfes; if ((hdrl_len - i) < sizeof(alWAVEFORMATEX)) wfes = hdrl_len - i; else wfes = sizeof(alWAVEFORMATEX); wfe = (alWAVEFORMATEX *)malloc(sizeof(alWAVEFORMATEX)); if (wfe != NULL) { memset(wfe, 0, sizeof(alWAVEFORMATEX)); memcpy(wfe, hdrl_data + i, wfes); if (str2ushort((unsigned char *)&wfe->cb_size) != 0) { nwfe = (char *) realloc(wfe, sizeof(alWAVEFORMATEX) + str2ushort((unsigned char *)&wfe->cb_size)); if (nwfe != 0) { int64_t lpos = xio_lseek(AVI->fdes, 0, SEEK_CUR); xio_lseek(AVI->fdes, header_offset + i + sizeof(alWAVEFORMATEX), SEEK_SET); wfe = (alWAVEFORMATEX *)nwfe; nwfe = &nwfe[sizeof(alWAVEFORMATEX)]; avi_read(AVI->fdes, nwfe, str2ushort((unsigned char *)&wfe->cb_size)); xio_lseek(AVI->fdes, lpos, SEEK_SET); } } AVI->wave_format_ex[AVI->aptr] = wfe; } AVI->track[AVI->aptr].a_fmt = str2ushort(hdrl_data+i ); //ThOe AVI->track[AVI->aptr].a_codecf_off = header_offset + i; AVI->track[AVI->aptr].a_chans = str2ushort(hdrl_data+i+2); AVI->track[AVI->aptr].a_rate = str2ulong (hdrl_data+i+4); //ThOe: read mp3bitrate AVI->track[AVI->aptr].mp3rate = 8*str2ulong(hdrl_data+i+8)/1000; //:ThOe AVI->track[AVI->aptr].a_bits = str2ushort(hdrl_data+i+14); // auds_strf_seen = 1; } } else if(strncasecmp(hdrl_data+i,"indx",4) == 0) { char *a; int j; if(lasttag == 1) // V I D E O { a = hdrl_data+i; AVI->video_superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk)); memcpy (AVI->video_superindex->fcc, a, 4); a += 4; AVI->video_superindex->dwSize = str2ulong(a); a += 4; AVI->video_superindex->wLongsPerEntry = str2ushort(a); a += 2; AVI->video_superindex->bIndexSubType = *a; a += 1; AVI->video_superindex->bIndexType = *a; a += 1; AVI->video_superindex->nEntriesInUse = str2ulong(a); a += 4; memcpy (AVI->video_superindex->dwChunkId, a, 4); a += 4; // 3 * reserved a += 4; a += 4; a += 4; if (AVI->video_superindex->bIndexSubType != 0) {fprintf(stderr, "Invalid Header, bIndexSubType != 0\n"); } AVI->video_superindex->aIndex = malloc (AVI->video_superindex->wLongsPerEntry * AVI->video_superindex->nEntriesInUse * sizeof (uint32_t)); // position of ix## chunks for (j=0; jvideo_superindex->nEntriesInUse; ++j) { AVI->video_superindex->aIndex[j].qwOffset = str2ullong (a); a += 8; AVI->video_superindex->aIndex[j].dwSize = str2ulong (a); a += 4; AVI->video_superindex->aIndex[j].dwDuration = str2ulong (a); a += 4; #ifdef DEBUG_ODML printf("[%d] 0x%llx 0x%lx %lu\n", j, (unsigned long long)AVI->video_superindex->aIndex[j].qwOffset, (unsigned long)AVI->video_superindex->aIndex[j].dwSize, (unsigned long)AVI->video_superindex->aIndex[j].dwDuration); #endif } #ifdef DEBUG_ODML printf("FOURCC \"%c%c%c%c\"\n", AVI->video_superindex->fcc[0], AVI->video_superindex->fcc[1], AVI->video_superindex->fcc[2], AVI->video_superindex->fcc[3]); printf("LEN \"%ld\"\n", (long)AVI->video_superindex->dwSize); printf("wLongsPerEntry \"%d\"\n", AVI->video_superindex->wLongsPerEntry); printf("bIndexSubType \"%d\"\n", AVI->video_superindex->bIndexSubType); printf("bIndexType \"%d\"\n", AVI->video_superindex->bIndexType); printf("nEntriesInUse \"%ld\"\n", (long)AVI->video_superindex->nEntriesInUse); printf("dwChunkId \"%c%c%c%c\"\n", AVI->video_superindex->dwChunkId[0], AVI->video_superindex->dwChunkId[1], AVI->video_superindex->dwChunkId[2], AVI->video_superindex->dwChunkId[3]); printf("--\n"); #endif AVI->is_opendml = 1; } else if(lasttag == 2) // A U D I O { a = hdrl_data+i; AVI->track[AVI->aptr].audio_superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk)); memcpy (AVI->track[AVI->aptr].audio_superindex->fcc, a, 4); a += 4; AVI->track[AVI->aptr].audio_superindex->dwSize = str2ulong(a); a += 4; AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry = str2ushort(a); a += 2; AVI->track[AVI->aptr].audio_superindex->bIndexSubType = *a; a += 1; AVI->track[AVI->aptr].audio_superindex->bIndexType = *a; a += 1; AVI->track[AVI->aptr].audio_superindex->nEntriesInUse = str2ulong(a); a += 4; memcpy (AVI->track[AVI->aptr].audio_superindex->dwChunkId, a, 4); a += 4; // 3 * reserved a += 4; a += 4; a += 4; if (AVI->track[AVI->aptr].audio_superindex->bIndexSubType != 0) {fprintf(stderr, "Invalid Header, bIndexSubType != 0\n"); } AVI->track[AVI->aptr].audio_superindex->aIndex = malloc (AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry * AVI->track[AVI->aptr].audio_superindex->nEntriesInUse * sizeof (uint32_t)); // position of ix## chunks for (j=0; jtrack[AVI->aptr].audio_superindex->nEntriesInUse; ++j) { AVI->track[AVI->aptr].audio_superindex->aIndex[j].qwOffset = str2ullong (a); a += 8; AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwSize = str2ulong (a); a += 4; AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwDuration = str2ulong (a); a += 4; #ifdef DEBUG_ODML printf("[%d] 0x%llx 0x%lx %lu\n", j, (unsigned long long)AVI->track[AVI->aptr].audio_superindex->aIndex[j].qwOffset, (unsigned long)AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwSize, (unsigned long)AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwDuration); #endif } #ifdef DEBUG_ODML printf("FOURCC \"%.4s\"\n", AVI->track[AVI->aptr].audio_superindex->fcc); printf("LEN \"%ld\"\n", (long)AVI->track[AVI->aptr].audio_superindex->dwSize); printf("wLongsPerEntry \"%d\"\n", AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry); printf("bIndexSubType \"%d\"\n", AVI->track[AVI->aptr].audio_superindex->bIndexSubType); printf("bIndexType \"%d\"\n", AVI->track[AVI->aptr].audio_superindex->bIndexType); printf("nEntriesInUse \"%ld\"\n", (long)AVI->track[AVI->aptr].audio_superindex->nEntriesInUse); printf("dwChunkId \"%.4s\"\n", AVI->track[AVI->aptr].audio_superindex->dwChunkId[0]); printf("--\n"); #endif } i += 8; } else if((strncasecmp(hdrl_data+i,"JUNK",4) == 0) || (strncasecmp(hdrl_data+i,"strn",4) == 0) || (strncasecmp(hdrl_data+i,"vprp",4) == 0)){ i += 8; // do not reset lasttag } else { i += 8; lasttag = 0; } //printf("adding %ld bytes\n", (long int)n); i += n; } free(hdrl_data); if(!vids_strh_seen || !vids_strf_seen) ERR_EXIT(AVI_ERR_NO_VIDS) AVI->video_tag[0] = AVI->video_strn/10 + '0'; AVI->video_tag[1] = AVI->video_strn%10 + '0'; AVI->video_tag[2] = 'd'; AVI->video_tag[3] = 'b'; /* Audio tag is set to "99wb" if no audio present */ if(!AVI->track[0].a_chans) AVI->track[0].audio_strn = 99; { int i=0; for(j=0; janum+1; ++j) { if (j == AVI->video_strn) continue; AVI->track[i].audio_tag[0] = j/10 + '0'; AVI->track[i].audio_tag[1] = j%10 + '0'; AVI->track[i].audio_tag[2] = 'w'; AVI->track[i].audio_tag[3] = 'b'; ++i; } } xio_lseek(AVI->fdes,AVI->movi_start,SEEK_SET); /* get index if wanted */ if(AVI->index_file && !getIndex) { int ret; ret = avi_parse_index_from_file(AVI, AVI->index_file); /* Reposition the file */ xio_lseek(AVI->fdes,AVI->movi_start,SEEK_SET); AVI->video_pos = 0; return (ret); } if(!getIndex) return(0); /* if the file has an idx1, check if this is relative to the start of the file or to the start of the movi list */ idx_type = 0; if(AVI->idx) { int64_t pos, len; /* Search the first videoframe in the idx1 and look where it is in the file */ for(i=0;in_idx;i++) if( strncasecmp((char *)AVI->idx[i],(char *)AVI->video_tag,3)==0 ) break; if(i>=AVI->n_idx) ERR_EXIT(AVI_ERR_NO_VIDS) pos = str2ulong(AVI->idx[i]+ 8); len = str2ulong(AVI->idx[i]+12); xio_lseek(AVI->fdes,pos,SEEK_SET); if(avi_read(AVI->fdes,data,8)!=8) ERR_EXIT(AVI_ERR_READ) if( strncasecmp(data,(char *)AVI->idx[i],4)==0 && str2ulong((unsigned char *)data+4)==len ) { idx_type = 1; /* Index from start of file */ } else { xio_lseek(AVI->fdes,pos+AVI->movi_start-4,SEEK_SET); if(avi_read(AVI->fdes,data,8)!=8) ERR_EXIT(AVI_ERR_READ) if( strncasecmp(data,(char *)AVI->idx[i],4)==0 && str2ulong((unsigned char *)data+4)==len ) { idx_type = 2; /* Index from start of movi list */ } } /* idx_type remains 0 if neither of the two tests above succeeds */ } if(idx_type == 0 && !AVI->is_opendml && !AVI->total_frames) { /* we must search through the file to get the index */ xio_lseek(AVI->fdes, AVI->movi_start, SEEK_SET); AVI->n_idx = 0; while(1) { if( avi_read(AVI->fdes,data,8) != 8 ) break; n = str2ulong((unsigned char *)data+4); /* The movi list may contain sub-lists, ignore them */ if(strncasecmp(data,"LIST",4)==0) { xio_lseek(AVI->fdes,4,SEEK_CUR); continue; } /* Check if we got a tag ##db, ##dc or ##wb */ if( ( (data[2]=='d' || data[2]=='D') && (data[3]=='b' || data[3]=='B' || data[3]=='c' || data[3]=='C') ) || ( (data[2]=='w' || data[2]=='W') && (data[3]=='b' || data[3]=='B') ) ) { avi_add_index_entry(AVI,(unsigned char *)data,0,xio_lseek(AVI->fdes,0,SEEK_CUR)-8,n); } xio_lseek(AVI->fdes,PAD_EVEN(n),SEEK_CUR); } idx_type = 1; } // ************************ // OPENDML // ************************ // read extended index chunks if (AVI->is_opendml) { uint64_t offset = 0; int hdrl_len = 4+4+2+1+1+4+4+8+4; char *en, *chunk_start; int k = 0, audtr = 0; uint32_t nrEntries = 0; AVI->video_index = NULL; nvi = 0; for(audtr=0; audtranum; ++audtr) nai[audtr] = tot[audtr] = 0; // ************************ // VIDEO // ************************ for (j=0; jvideo_superindex->nEntriesInUse; j++) { // read from file chunk_start = en = malloc (AVI->video_superindex->aIndex[j].dwSize+hdrl_len); if (xio_lseek(AVI->fdes, AVI->video_superindex->aIndex[j].qwOffset, SEEK_SET) == (int64_t)-1) { fprintf(stderr, "(%s) cannot seek to 0x%llx\n", __FILE__, (unsigned long long)AVI->video_superindex->aIndex[j].qwOffset); free(chunk_start); continue; } if (avi_read(AVI->fdes, en, AVI->video_superindex->aIndex[j].dwSize+hdrl_len) <= 0) { fprintf(stderr, "(%s) cannot read from offset 0x%llx %ld bytes; broken (incomplete) file?\n", __FILE__, (unsigned long long)AVI->video_superindex->aIndex[j].qwOffset, (unsigned long)AVI->video_superindex->aIndex[j].dwSize+hdrl_len); free(chunk_start); continue; } nrEntries = str2ulong(en + 12); #ifdef DEBUG_ODML //printf("[%d:0] Video nrEntries %ld\n", j, nrEntries); #endif offset = str2ullong(en + 20); // skip header en += hdrl_len; nvi += nrEntries; AVI->video_index = (video_index_entry *) realloc (AVI->video_index, nvi * sizeof (video_index_entry)); if (!AVI->video_index) { fprintf(stderr, "AVILIB: out of mem (size = %ld)\n", nvi * sizeof (video_index_entry)); exit(1); } while (k < nvi) { AVI->video_index[k].pos = offset + str2ulong(en); en += 4; AVI->video_index[k].len = str2ulong_len(en); AVI->video_index[k].key = str2ulong_key(en); en += 4; // completely empty chunk if (AVI->video_index[k].pos-offset == 0 && AVI->video_index[k].len == 0) { k--; nvi--; } #ifdef DEBUG_ODML /* printf("[%d] POS 0x%llX len=%d key=%s offset (%llx) (%ld)\n", k, AVI->video_index[k].pos, (int)AVI->video_index[k].len, AVI->video_index[k].key?"yes":"no ", offset, AVI->video_superindex->aIndex[j].dwSize); */ #endif k++; } free(chunk_start); } AVI->video_frames = nvi; // this should deal with broken 'rec ' odml files. if (AVI->video_frames == 0) { AVI->is_opendml=0; goto multiple_riff; } // ************************ // AUDIO // ************************ for(audtr=0; audtranum; ++audtr) { k = 0; if (!AVI->track[audtr].audio_superindex) { fprintf(stderr, "(%s) cannot read audio index for track %d\n", __FILE__, audtr); continue; } for (j=0; jtrack[audtr].audio_superindex->nEntriesInUse; j++) { // read from file chunk_start = en = malloc (AVI->track[audtr].audio_superindex->aIndex[j].dwSize+hdrl_len); if (xio_lseek(AVI->fdes, AVI->track[audtr].audio_superindex->aIndex[j].qwOffset, SEEK_SET) == (int64_t)-1) { fprintf(stderr, "(%s) cannot seek to 0x%llx\n", __FILE__, (unsigned long long)AVI->track[audtr].audio_superindex->aIndex[j].qwOffset); free(chunk_start); continue; } if (avi_read(AVI->fdes, en, AVI->track[audtr].audio_superindex->aIndex[j].dwSize+hdrl_len) <= 0) { fprintf(stderr, "(%s) cannot read from offset 0x%llx; broken (incomplete) file?\n", __FILE__,(unsigned long long) AVI->track[audtr].audio_superindex->aIndex[j].qwOffset); free(chunk_start); continue; } nrEntries = str2ulong(en + 12); //if (nrEntries > 50) nrEntries = 2; // XXX #ifdef DEBUG_ODML //printf("[%d:%d] Audio nrEntries %ld\n", j, audtr, nrEntries); #endif offset = str2ullong(en + 20); // skip header en += hdrl_len; nai[audtr] += nrEntries; AVI->track[audtr].audio_index = (audio_index_entry *) realloc (AVI->track[audtr].audio_index, nai[audtr] * sizeof (audio_index_entry)); while (k < nai[audtr]) { AVI->track[audtr].audio_index[k].pos = offset + str2ulong(en); en += 4; AVI->track[audtr].audio_index[k].len = str2ulong_len(en); en += 4; AVI->track[audtr].audio_index[k].tot = tot[audtr]; tot[audtr] += AVI->track[audtr].audio_index[k].len; #ifdef DEBUG_ODML /* printf("[%d:%d] POS 0x%llX len=%d offset (%llx) (%ld)\n", k, audtr, AVI->track[audtr].audio_index[k].pos, (int)AVI->track[audtr].audio_index[k].len, offset, AVI->track[audtr].audio_superindex->aIndex[j].dwSize); */ #endif ++k; } free(chunk_start); } AVI->track[audtr].audio_chunks = nai[audtr]; AVI->track[audtr].audio_bytes = tot[audtr]; } } // is opendml else if (AVI->total_frames && !AVI->is_opendml && idx_type==0) { // ********************* // MULTIPLE RIFF CHUNKS (and no index) // ********************* long aud_chunks = 0; multiple_riff: xio_lseek(AVI->fdes, AVI->movi_start, SEEK_SET); AVI->n_idx = 0; fprintf(stderr, "[avilib] Reconstructing index..."); // Number of frames; only one audio track supported nvi = AVI->video_frames = AVI->total_frames; nai[0] = AVI->track[0].audio_chunks = AVI->total_frames; for(j=1; janum; ++j) AVI->track[j].audio_chunks = 0; AVI->video_index = (video_index_entry *) malloc(nvi*sizeof(video_index_entry)); if(AVI->video_index==0) ERR_EXIT(AVI_ERR_NO_MEM); for(j=0; janum; ++j) { if(AVI->track[j].audio_chunks) { AVI->track[j].audio_index = (audio_index_entry *) malloc((nai[j]+1)*sizeof(audio_index_entry)); memset(AVI->track[j].audio_index, 0, (nai[j]+1)*(sizeof(audio_index_entry))); if(AVI->track[j].audio_index==0) ERR_EXIT(AVI_ERR_NO_MEM); } } nvi = 0; for(j=0; janum; ++j) nai[j] = tot[j] = 0; aud_chunks = AVI->total_frames; while(1) { if (nvi >= AVI->total_frames) break; if( avi_read(AVI->fdes,data,8) != 8 ) break; n = str2ulong((unsigned char *)data+4); j=0; if (aud_chunks - nai[j] -1 <= 0) { aud_chunks += AVI->total_frames; AVI->track[j].audio_index = (audio_index_entry *) realloc( AVI->track[j].audio_index, (aud_chunks+1)*sizeof(audio_index_entry)); if (!AVI->track[j].audio_index) { fprintf(stderr, "Internal error in avilib -- no mem\n"); AVI_errno = AVI_ERR_NO_MEM; return -1; } } /* Check if we got a tag ##db, ##dc or ##wb */ // VIDEO if( (data[0]=='0' || data[1]=='0') && (data[2]=='d' || data[2]=='D') && (data[3]=='b' || data[3]=='B' || data[3]=='c' || data[3]=='C') ) { AVI->video_index[nvi].key = 0x0; AVI->video_index[nvi].pos = xio_lseek(AVI->fdes,0,SEEK_CUR); AVI->video_index[nvi].len = n; /* fprintf(stderr, "Frame %ld pos %lld len %lld key %ld\n", nvi, AVI->video_index[nvi].pos, AVI->video_index[nvi].len, (long)AVI->video_index[nvi].key); */ nvi++; xio_lseek(AVI->fdes,PAD_EVEN(n),SEEK_CUR); } //AUDIO else if( (data[0]=='0' || data[1]=='1') && (data[2]=='w' || data[2]=='W') && (data[3]=='b' || data[3]=='B') ) { AVI->track[j].audio_index[nai[j]].pos = xio_lseek(AVI->fdes,0,SEEK_CUR); AVI->track[j].audio_index[nai[j]].len = n; AVI->track[j].audio_index[nai[j]].tot = tot[j]; tot[j] += AVI->track[j].audio_index[nai[j]].len; nai[j]++; xio_lseek(AVI->fdes,PAD_EVEN(n),SEEK_CUR); } else { xio_lseek(AVI->fdes,-4,SEEK_CUR); } } if (nvi < AVI->total_frames) { fprintf(stderr, "\n[avilib] Uh? Some frames seems missing (%ld/%d)\n", nvi, AVI->total_frames); } AVI->video_frames = nvi; AVI->track[0].audio_chunks = nai[0]; for(j=0; janum; ++j) AVI->track[j].audio_bytes = tot[j]; idx_type = 1; fprintf(stderr, "done. nvi=%ld nai=%ld tot=%ld\n", nvi, nai[0], tot[0]); } // total_frames but no indx chunk (xawtv does this) else { // ****************** // NO OPENDML // ****************** /* Now generate the video index and audio index arrays */ nvi = 0; for(j=0; janum; ++j) nai[j] = 0; for(i=0;in_idx;i++) { if(strncasecmp((char *)AVI->idx[i],AVI->video_tag,3) == 0) nvi++; for(j=0; janum; ++j) if(strncasecmp((char *)AVI->idx[i], AVI->track[j].audio_tag,4) == 0) nai[j]++; } AVI->video_frames = nvi; for(j=0; janum; ++j) AVI->track[j].audio_chunks = nai[j]; if(AVI->video_frames==0) ERR_EXIT(AVI_ERR_NO_VIDS); AVI->video_index = (video_index_entry *) malloc(nvi*sizeof(video_index_entry)); if(AVI->video_index==0) ERR_EXIT(AVI_ERR_NO_MEM); for(j=0; janum; ++j) { if(AVI->track[j].audio_chunks) { AVI->track[j].audio_index = (audio_index_entry *) malloc((nai[j]+1)*sizeof(audio_index_entry)); memset(AVI->track[j].audio_index, 0, (nai[j]+1)*(sizeof(audio_index_entry))); if(AVI->track[j].audio_index==0) ERR_EXIT(AVI_ERR_NO_MEM); } } nvi = 0; for(j=0; janum; ++j) nai[j] = tot[j] = 0; ioff = idx_type == 1 ? 8 : AVI->movi_start+4; for(i=0;in_idx;i++) { //video if(strncasecmp((char *)AVI->idx[i],AVI->video_tag,3) == 0) { AVI->video_index[nvi].key = str2ulong(AVI->idx[i]+ 4); AVI->video_index[nvi].pos = str2ulong(AVI->idx[i]+ 8)+ioff; AVI->video_index[nvi].len = str2ulong(AVI->idx[i]+12); nvi++; } //audio for(j=0; janum; ++j) { if(strncasecmp((char *)AVI->idx[i],AVI->track[j].audio_tag,4) == 0) { AVI->track[j].audio_index[nai[j]].pos = str2ulong(AVI->idx[i]+ 8)+ioff; AVI->track[j].audio_index[nai[j]].len = str2ulong(AVI->idx[i]+12); AVI->track[j].audio_index[nai[j]].tot = tot[j]; tot[j] += AVI->track[j].audio_index[nai[j]].len; nai[j]++; } } } for(j=0; janum; ++j) AVI->track[j].audio_bytes = tot[j]; } // is no opendml /* Reposition the file */ xio_lseek(AVI->fdes,AVI->movi_start,SEEK_SET); AVI->video_pos = 0; return(0); } long AVI_video_frames(avi_t *AVI) { return AVI->video_frames; } int AVI_video_width(avi_t *AVI) { return AVI->width; } int AVI_video_height(avi_t *AVI) { return AVI->height; } double AVI_frame_rate(avi_t *AVI) { return AVI->fps; } char* AVI_video_compressor(avi_t *AVI) { return AVI->compressor2; } long AVI_max_video_chunk(avi_t *AVI) { return AVI->max_len; } int AVI_audio_tracks(avi_t *AVI) { return(AVI->anum); } int AVI_audio_channels(avi_t *AVI) { return AVI->track[AVI->aptr].a_chans; } long AVI_audio_mp3rate(avi_t *AVI) { return AVI->track[AVI->aptr].mp3rate; } long AVI_audio_padrate(avi_t *AVI) { return AVI->track[AVI->aptr].padrate; } int AVI_audio_bits(avi_t *AVI) { return AVI->track[AVI->aptr].a_bits; } int AVI_audio_format(avi_t *AVI) { return AVI->track[AVI->aptr].a_fmt; } long AVI_audio_rate(avi_t *AVI) { return AVI->track[AVI->aptr].a_rate; } long AVI_audio_bytes(avi_t *AVI) { return AVI->track[AVI->aptr].audio_bytes; } long AVI_audio_chunks(avi_t *AVI) { return AVI->track[AVI->aptr].audio_chunks; } long AVI_audio_codech_offset(avi_t *AVI) { return AVI->track[AVI->aptr].a_codech_off; } long AVI_audio_codecf_offset(avi_t *AVI) { return AVI->track[AVI->aptr].a_codecf_off; } long AVI_video_codech_offset(avi_t *AVI) { return AVI->v_codech_off; } long AVI_video_codecf_offset(avi_t *AVI) { return AVI->v_codecf_off; } long AVI_frame_size(avi_t *AVI, long frame) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->video_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if(frame < 0 || frame >= AVI->video_frames) return 0; return(AVI->video_index[frame].len); } long AVI_audio_size(avi_t *AVI, long frame) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->track[AVI->aptr].audio_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if(frame < 0 || frame >= AVI->track[AVI->aptr].audio_chunks) return -1; return(AVI->track[AVI->aptr].audio_index[frame].len); } long AVI_get_video_position(avi_t *AVI, long frame) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->video_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if(frame < 0 || frame >= AVI->video_frames) return 0; return(AVI->video_index[frame].pos); } int AVI_seek_start(avi_t *AVI) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } xio_lseek(AVI->fdes,AVI->movi_start,SEEK_SET); AVI->video_pos = 0; return 0; } int AVI_set_video_position(avi_t *AVI, long frame) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->video_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if (frame < 0 ) frame = 0; AVI->video_pos = frame; return 0; } int AVI_set_audio_bitrate(avi_t *AVI, long bitrate) { if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } AVI->track[AVI->aptr].mp3rate = bitrate; return 0; } long AVI_read_frame(avi_t *AVI, char *vidbuf, int *keyframe) { long n; if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->video_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if(AVI->video_pos < 0 || AVI->video_pos >= AVI->video_frames) return -1; n = AVI->video_index[AVI->video_pos].len; *keyframe = (AVI->video_index[AVI->video_pos].key==0x10) ? 1:0; if (vidbuf == NULL) { AVI->video_pos++; return n; } xio_lseek(AVI->fdes, AVI->video_index[AVI->video_pos].pos, SEEK_SET); if (avi_read(AVI->fdes,vidbuf,n) != n) { AVI_errno = AVI_ERR_READ; return -1; } AVI->video_pos++; return n; } long AVI_get_audio_position_index(avi_t *AVI) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->track[AVI->aptr].audio_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } return (AVI->track[AVI->aptr].audio_posc); } int AVI_set_audio_position_index(avi_t *AVI, long indexpos) { if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->track[AVI->aptr].audio_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if(indexpos > AVI->track[AVI->aptr].audio_chunks) { AVI_errno = AVI_ERR_NO_IDX; return -1; } AVI->track[AVI->aptr].audio_posc = indexpos; AVI->track[AVI->aptr].audio_posb = 0; return 0; } int AVI_set_audio_position(avi_t *AVI, long byte) { long n0, n1, n; if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->track[AVI->aptr].audio_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if(byte < 0) byte = 0; /* Binary search in the audio chunks */ n0 = 0; n1 = AVI->track[AVI->aptr].audio_chunks; while(n0track[AVI->aptr].audio_index[n].tot>byte) n1 = n; else n0 = n; } AVI->track[AVI->aptr].audio_posc = n0; AVI->track[AVI->aptr].audio_posb = byte - AVI->track[AVI->aptr].audio_index[n0].tot; return 0; } long AVI_read_audio(avi_t *AVI, char *audbuf, long bytes) { long nr, left, todo; int64_t pos; if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->track[AVI->aptr].audio_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } nr = 0; /* total number of bytes read */ if (bytes==0) { AVI->track[AVI->aptr].audio_posc++; AVI->track[AVI->aptr].audio_posb = 0; xio_lseek(AVI->fdes, 0LL, SEEK_CUR); } while(bytes>0) { int64_t ret; left = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].len - AVI->track[AVI->aptr].audio_posb; if(left==0) { if(AVI->track[AVI->aptr].audio_posc>=AVI->track[AVI->aptr].audio_chunks-1) return nr; AVI->track[AVI->aptr].audio_posc++; AVI->track[AVI->aptr].audio_posb = 0; continue; } if(bytestrack[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].pos + AVI->track[AVI->aptr].audio_posb; xio_lseek(AVI->fdes, pos, SEEK_SET); if ( (ret = avi_read(AVI->fdes,audbuf+nr,todo)) != todo) { fprintf(stderr, "XXX pos = %lld, ret = %lld, todo = %ld\n", pos, ret, todo); AVI_errno = AVI_ERR_READ; return -1; } bytes -= todo; nr += todo; AVI->track[AVI->aptr].audio_posb += todo; } return nr; } long AVI_read_audio_chunk(avi_t *AVI, char *audbuf) { int64_t pos, left; if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; } if(!AVI->track[AVI->aptr].audio_index) { AVI_errno = AVI_ERR_NO_IDX; return -1; } if (AVI->track[AVI->aptr].audio_posc+1>AVI->track[AVI->aptr].audio_chunks) return -1; left = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].len - AVI->track[AVI->aptr].audio_posb; if (audbuf == NULL) return left; if(left==0) { AVI->track[AVI->aptr].audio_posc++; AVI->track[AVI->aptr].audio_posb = 0; return 0; } pos = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].pos + AVI->track[AVI->aptr].audio_posb; xio_lseek(AVI->fdes, pos, SEEK_SET); if (avi_read(AVI->fdes,audbuf,left) != left) { AVI_errno = AVI_ERR_READ; return -1; } AVI->track[AVI->aptr].audio_posc++; AVI->track[AVI->aptr].audio_posb = 0; return left; } /* AVI_read_data: Special routine for reading the next audio or video chunk without having an index of the file. */ int AVI_read_data(avi_t *AVI, char *vidbuf, long max_vidbuf, char *audbuf, long max_audbuf, long *len) { /* * Return codes: * * 1 = video data read * 2 = audio data read * 0 = reached EOF * -1 = video buffer too small * -2 = audio buffer too small */ int64_t n; char data[8]; if(AVI->mode==AVI_MODE_WRITE) return 0; while(1) { /* Read tag and length */ if( avi_read(AVI->fdes,data,8) != 8 ) return 0; /* if we got a list tag, ignore it */ if(strncasecmp(data,"LIST",4) == 0) { xio_lseek(AVI->fdes,4,SEEK_CUR); continue; } n = PAD_EVEN(str2ulong((unsigned char *)data+4)); if(strncasecmp(data,AVI->video_tag,3) == 0) { *len = n; AVI->video_pos++; if(n>max_vidbuf) { xio_lseek(AVI->fdes,n,SEEK_CUR); return -1; } if(avi_read(AVI->fdes,vidbuf,n) != n ) return 0; return 1; } else if(strncasecmp(data,AVI->track[AVI->aptr].audio_tag,4) == 0) { *len = n; if(n>max_audbuf) { xio_lseek(AVI->fdes,n,SEEK_CUR); return -2; } if(avi_read(AVI->fdes,audbuf,n) != n ) return 0; return 2; break; } else if(xio_lseek(AVI->fdes,n,SEEK_CUR)<0) return 0; } } /* AVI_print_error: Print most recent error (similar to perror) */ char *(avi_errors[]) = { /* 0 */ "avilib - No Error", /* 1 */ "avilib - AVI file size limit reached", /* 2 */ "avilib - Error opening AVI file", /* 3 */ "avilib - Error reading from AVI file", /* 4 */ "avilib - Error writing to AVI file", /* 5 */ "avilib - Error writing index (file may still be useable)", /* 6 */ "avilib - Error closing AVI file", /* 7 */ "avilib - Operation (read/write) not permitted", /* 8 */ "avilib - Out of memory (malloc failed)", /* 9 */ "avilib - Not an AVI file", /* 10 */ "avilib - AVI file has no header list (corrupted?)", /* 11 */ "avilib - AVI file has no MOVI list (corrupted?)", /* 12 */ "avilib - AVI file has no video data", /* 13 */ "avilib - operation needs an index", /* 14 */ "avilib - Unkown Error" }; static int num_avi_errors = sizeof(avi_errors)/sizeof(char*); static char error_string[4096]; void AVI_print_error(char *str) { int aerrno; aerrno = (AVI_errno>=0 && AVI_errno=0 && AVI_errnoriff.id ,buf+0, 4); memcpy(&wave->riff.len ,buf+4, 4); memcpy(&wave->riff.wave_id ,buf+8, 4); memcpy(&wave->format.id ,buf+12, 4); memcpy(&wave->format.len ,buf+16, 4); memcpy(&wave->common.wFormatTag ,buf+20, 2); memcpy(&wave->common.wChannels ,buf+22, 2); memcpy(&wave->common.dwSamplesPerSec ,buf+24, 4); memcpy(&wave->common.dwAvgBytesPerSec ,buf+28, 4); memcpy(&wave->common.wBlockAlign ,buf+32, 2); memcpy(&wave->common.wBitsPerSample ,buf+34, 2); memcpy(&wave->data.id ,buf+36, 4); memcpy(&wave->data.len ,buf+40, 4); /* fprintf(stderr, "RIFF: %c%c%c%c| (%d) (%d)\n", wave->riff.id[0], wave->riff.id[1], wave->riff.id[2], wave->riff.id[3], sizeof (*wave), sizeof (struct wave_header)); fprintf(stderr, "WAVE: %c%c%c%c|\n", wave->riff.wave_id[0], wave->riff.wave_id[1], wave->riff.wave_id[2], wave->riff.wave_id[3]); fprintf(stderr, "fmt : %c%c%c%c|\n", wave->format.id[0], wave->format.id[1], wave->format.id[2], wave->format.id[3]); fprintf(stderr, "data: %c%c%c%c|\n", wave->data.id[0], wave->data.id[1], wave->data.id[2], wave->data.id[3]); */ if( strncasecmp(wave->riff.id , "RIFF",4) != 0 || strncasecmp(wave->riff.wave_id, "WAVE",4) != 0 || strncasecmp(wave->format.id , "fmt ",4) != 0 ) { AVI_errno = AVI_ERR_NO_AVI; return -1; } #ifdef WORDS_BIGENDIAN #define x_FIXUP(field) \ ((field) = (sizeof(field) == 4 ? str2ulong((unsigned char*)&(field)) \ : str2ushort((unsigned char*)&(field)))) x_FIXUP(wave->riff.len); x_FIXUP(wave->format.len); x_FIXUP(wave->common.wFormatTag); x_FIXUP(wave->common.wChannels); x_FIXUP(wave->common.dwSamplesPerSec); x_FIXUP(wave->common.dwAvgBytesPerSec); x_FIXUP(wave->common.wBlockAlign); x_FIXUP(wave->common.wBitsPerSample); x_FIXUP(wave->data.len); #undef x_FIXUP #endif return 0; } int AVI_write_wave_header( int fd, const struct wave_header * wave ) { char buf[44]; struct wave_header buffer = *wave; #ifdef WORDS_BIGENDIAN #define x_FIXUP(field) \ ((sizeof(field) == 4 ? long2str((unsigned char*)&(field),(field)) \ : short2str((unsigned char*)&(field),(field)))) x_FIXUP(buffer.riff.len); x_FIXUP(buffer.format.len); x_FIXUP(buffer.common.wFormatTag); x_FIXUP(buffer.common.wChannels); x_FIXUP(buffer.common.dwSamplesPerSec); x_FIXUP(buffer.common.dwAvgBytesPerSec); x_FIXUP(buffer.common.wBlockAlign); x_FIXUP(buffer.common.wBitsPerSample); x_FIXUP(buffer.data.len); #undef x_FIXUP #endif memcpy(buf+ 0, &buffer.riff.id, 4); memcpy(buf+ 4, &buffer.riff.len, 4); memcpy(buf+ 8, &buffer.riff.wave_id, 4); memcpy(buf+12, &buffer.format.id, 4); memcpy(buf+16, &buffer.format.len, 4); memcpy(buf+20, &buffer.common.wFormatTag, 2); memcpy(buf+22, &buffer.common.wChannels, 2); memcpy(buf+24, &buffer.common.dwSamplesPerSec, 4); memcpy(buf+28, &buffer.common.dwAvgBytesPerSec, 4); memcpy(buf+32, &buffer.common.wBlockAlign, 2); memcpy(buf+34, &buffer.common.wBitsPerSample, 2); memcpy(buf+36, &buffer.data.id, 4); memcpy(buf+40, &buffer.data.len, 4); // write raw data if( avi_write (fd, buf, sizeof(buf)) != sizeof(buf) ) { AVI_errno = AVI_ERR_WRITE; return -1; } return 0; } size_t AVI_read_wave_pcm_data( int fd, void * buffer, size_t buflen ) { int doneread = avi_read(fd, buffer, buflen); #ifdef WORDS_BIGENDIAN { char * bufptr = buffer; size_t i; char tmp; for( i=0; i0 ) { buflen = datalen; if( buflen > sizeof(buffer) ) { buflen = sizeof(buffer); } for( i=0; i * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include #include #include #include #include #include #ifndef AVILIB_H #define AVILIB_H #define COMP_GCC #define SYS_LINUX #define SYS_UNIX #define AVI_MAX_TRACKS 8 typedef struct { int64_t key; int64_t pos; int64_t len; } video_index_entry; typedef struct { int64_t pos; int64_t len; int64_t tot; } audio_index_entry; // Index types #define AVI_INDEX_OF_INDEXES 0x00 // when each entry in aIndex // array points to an index chunk #define AVI_INDEX_OF_CHUNKS 0x01 // when each entry in aIndex // array points to a chunk in the file #define AVI_INDEX_IS_DATA 0x80 // when each entry is aIndex is // really the data // bIndexSubtype codes for INDEX_OF_CHUNKS // #define AVI_INDEX_2FIELD 0x01 // when fields within frames // are also indexed typedef struct _avisuperindex_entry { uint64_t qwOffset; // absolute file offset uint32_t dwSize; // size of index chunk at this offset uint32_t dwDuration; // time span in stream ticks } avisuperindex_entry; typedef struct _avistdindex_entry { uint32_t dwOffset; // qwBaseOffset + this is absolute file offset uint32_t dwSize; // bit 31 is set if this is NOT a keyframe } avistdindex_entry; // Standard index typedef struct _avistdindex_chunk { char fcc[4]; // ix## uint32_t dwSize; // size of this chunk uint16_t wLongsPerEntry; // must be sizeof(aIndex[0])/sizeof(DWORD) uint8_t bIndexSubType; // must be 0 uint8_t bIndexType; // must be AVI_INDEX_OF_CHUNKS uint32_t nEntriesInUse; // char dwChunkId[4]; // '##dc' or '##db' or '##wb' etc.. uint64_t qwBaseOffset; // all dwOffsets in aIndex array are relative to this uint32_t dwReserved3; // must be 0 avistdindex_entry *aIndex; } avistdindex_chunk; // Base Index Form 'indx' typedef struct _avisuperindex_chunk { char fcc[4]; uint32_t dwSize; // size of this chunk uint16_t wLongsPerEntry; // size of each entry in aIndex array (must be 8 for us) uint8_t bIndexSubType; // future use. must be 0 uint8_t bIndexType; // one of AVI_INDEX_* codes uint32_t nEntriesInUse; // index of first unused member in aIndex array char dwChunkId[4]; // fcc of what is indexed uint32_t dwReserved[3]; // meaning differs for each index type/subtype. // 0 if unused avisuperindex_entry *aIndex; // where are the ix## chunks avistdindex_chunk **stdindex; // the ix## chunks itself (array) } avisuperindex_chunk; typedef struct track_s { long a_fmt; /* Audio format, see #defines below */ long a_chans; /* Audio channels, 0 for no audio */ long a_rate; /* Rate in Hz */ long a_bits; /* bits per audio sample */ long mp3rate; /* mp3 bitrate kbs*/ long a_vbr; /* 0 == no Variable BitRate */ long padrate; /* byte rate used for zero padding */ long audio_strn; /* Audio stream number */ int64_t audio_bytes; /* Total number of bytes of audio data */ long audio_chunks; /* Chunks of audio data in the file */ char audio_tag[4]; /* Tag of audio data */ long audio_posc; /* Audio position: chunk */ long audio_posb; /* Audio position: byte within chunk */ int64_t a_codech_off; /* absolut offset of audio codec information */ int64_t a_codecf_off; /* absolut offset of audio codec information */ audio_index_entry *audio_index; avisuperindex_chunk *audio_superindex; } track_t; typedef struct { uint32_t bi_size; uint32_t bi_width; uint32_t bi_height; uint16_t bi_planes; uint16_t bi_bit_count; uint32_t bi_compression; uint32_t bi_size_image; uint32_t bi_x_pels_per_meter; uint32_t bi_y_pels_per_meter; uint32_t bi_clr_used; uint32_t bi_clr_important; } alBITMAPINFOHEADER; typedef struct __attribute__((__packed__)) { uint16_t w_format_tag; uint16_t n_channels; uint32_t n_samples_per_sec; uint32_t n_avg_bytes_per_sec; uint16_t n_block_align; uint16_t w_bits_per_sample; uint16_t cb_size; } alWAVEFORMATEX; typedef struct __attribute__((__packed__)) { uint32_t fcc_type; uint32_t fcc_handler; uint32_t dw_flags; uint32_t dw_caps; uint16_t w_priority; uint16_t w_language; uint32_t dw_scale; uint32_t dw_rate; uint32_t dw_start; uint32_t dw_length; uint32_t dw_initial_frames; uint32_t dw_suggested_buffer_size; uint32_t dw_quality; uint32_t dw_sample_size; uint16_t dw_left; uint16_t dw_top; uint16_t dw_right; uint16_t dw_bottom; } alAVISTREAMHEADER; typedef struct { long fdes; /* File descriptor of AVI file */ long mode; /* 0 for reading, 1 for writing */ long width; /* Width of a video frame */ long height; /* Height of a video frame */ double fps; /* Frames per second */ char compressor[8]; /* Type of compressor, 4 bytes + padding for 0 byte */ char compressor2[8]; /* Type of compressor, 4 bytes + padding for 0 byte */ long video_strn; /* Video stream number */ long video_frames; /* Number of video frames */ char video_tag[4]; /* Tag of video data */ long video_pos; /* Number of next frame to be read (if index present) */ alAVISTREAMHEADER video_stream_header; uint32_t max_len; /* maximum video chunk present */ track_t track[AVI_MAX_TRACKS]; // up to AVI_MAX_TRACKS audio tracks supported int64_t pos; /* position in file */ long n_idx; /* number of index entries actually filled */ long max_idx; /* number of index entries actually allocated */ int64_t v_codech_off; /* absolut offset of video codec (strh) info */ int64_t v_codecf_off; /* absolut offset of video codec (strf) info */ uint8_t (*idx)[16]; /* index entries (AVI idx1 tag) */ video_index_entry *video_index; avisuperindex_chunk *video_superindex; /* index of indices */ int is_opendml; /* set to 1 if this is an odml file with multiple index chunks */ int64_t last_pos; /* Position of last frame written */ uint32_t last_len; /* Length of last frame written */ int must_use_index; /* Flag if frames are duplicated */ int64_t movi_start; int total_frames; /* total number of frames if dmlh is present */ int anum; // total number of audio tracks int aptr; // current audio working track int comment_fd; // Read avi header comments from this fd char *index_file; // read the avi index from this file alBITMAPINFOHEADER *bitmap_info_header; alWAVEFORMATEX *wave_format_ex[AVI_MAX_TRACKS]; alAVISTREAMHEADER stream_headers[AVI_MAX_TRACKS]; void* extradata; unsigned long extradata_size; } avi_t; #define AVI_MODE_WRITE 0 #define AVI_MODE_READ 1 /* The error codes delivered by avi_open_input_file */ #define AVI_ERR_SIZELIM 1 /* The write of the data would exceed the maximum size of the AVI file. This is more a warning than an error since the file may be closed safely */ #define AVI_ERR_OPEN 2 /* Error opening the AVI file - wrong path name or file nor readable/writable */ #define AVI_ERR_READ 3 /* Error reading from AVI File */ #define AVI_ERR_WRITE 4 /* Error writing to AVI File, disk full ??? */ #define AVI_ERR_WRITE_INDEX 5 /* Could not write index to AVI file during close, file may still be usable */ #define AVI_ERR_CLOSE 6 /* Could not write header to AVI file or not truncate the file during close, file is most probably corrupted */ #define AVI_ERR_NOT_PERM 7 /* Operation not permitted: trying to read from a file open for writing or vice versa */ #define AVI_ERR_NO_MEM 8 /* malloc failed */ #define AVI_ERR_NO_AVI 9 /* Not an AVI file */ #define AVI_ERR_NO_HDRL 10 /* AVI file has no has no header list, corrupted ??? */ #define AVI_ERR_NO_MOVI 11 /* AVI file has no has no MOVI list, corrupted ??? */ #define AVI_ERR_NO_VIDS 12 /* AVI file contains no video data */ #define AVI_ERR_NO_IDX 13 /* The file has been opened with getIndex==0, but an operation has been performed that needs an index */ /* Possible Audio formats */ #ifndef WAVE_FORMAT_PCM #define WAVE_FORMAT_UNKNOWN (0x0000) #define WAVE_FORMAT_PCM (0x0001) #define WAVE_FORMAT_ADPCM (0x0002) #define WAVE_FORMAT_IBM_CVSD (0x0005) #define WAVE_FORMAT_ALAW (0x0006) #define WAVE_FORMAT_MULAW (0x0007) #define WAVE_FORMAT_OKI_ADPCM (0x0010) #define WAVE_FORMAT_DVI_ADPCM (0x0011) #define WAVE_FORMAT_DIGISTD (0x0015) #define WAVE_FORMAT_DIGIFIX (0x0016) #define WAVE_FORMAT_YAMAHA_ADPCM (0x0020) #define WAVE_FORMAT_DSP_TRUESPEECH (0x0022) #define WAVE_FORMAT_GSM610 (0x0031) #define IBM_FORMAT_MULAW (0x0101) #define IBM_FORMAT_ALAW (0x0102) #define IBM_FORMAT_ADPCM (0x0103) #endif avi_t* AVI_open_output_file(char * filename); void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compressor); void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format, long mp3rate); int AVI_write_frame(avi_t *AVI, char *data, long bytes, int keyframe); int AVI_dup_frame(avi_t *AVI); int AVI_write_audio(avi_t *AVI, char *data, long bytes); int AVI_append_audio(avi_t *AVI, char *data, long bytes); long AVI_bytes_remain(avi_t *AVI); int AVI_close(avi_t *AVI); long AVI_bytes_written(avi_t *AVI); avi_t *AVI_open_input_file(char *filename, int getIndex); avi_t *AVI_open_input_indexfile(char *filename, int getIndex, char *indexfile); avi_t *AVI_open_fd(int fd, int getIndex); avi_t *AVI_open_indexfd(int fd, int getIndex, char *indexfile); int avi_parse_input_file(avi_t *AVI, int getIndex); int avi_parse_index_from_file(avi_t *AVI, char *filename); long AVI_audio_mp3rate(avi_t *AVI); long AVI_audio_padrate(avi_t *AVI); long AVI_video_frames(avi_t *AVI); int AVI_video_width(avi_t *AVI); int AVI_video_height(avi_t *AVI); double AVI_frame_rate(avi_t *AVI); char* AVI_video_compressor(avi_t *AVI); int AVI_audio_channels(avi_t *AVI); int AVI_audio_bits(avi_t *AVI); int AVI_audio_format(avi_t *AVI); long AVI_audio_rate(avi_t *AVI); long AVI_audio_bytes(avi_t *AVI); long AVI_audio_chunks(avi_t *AVI); int AVI_can_read_audio(avi_t *AVI); long AVI_max_video_chunk(avi_t *AVI); long AVI_frame_size(avi_t *AVI, long frame); long AVI_audio_size(avi_t *AVI, long frame); int AVI_seek_start(avi_t *AVI); int AVI_set_video_position(avi_t *AVI, long frame); long AVI_get_video_position(avi_t *AVI, long frame); long AVI_read_frame(avi_t *AVI, char *vidbuf, int *keyframe); int AVI_set_audio_position(avi_t *AVI, long byte); int AVI_set_audio_bitrate(avi_t *AVI, long bitrate); long AVI_get_audio_position_index(avi_t *AVI); int AVI_set_audio_position_index(avi_t *AVI, long indexpos); long AVI_read_audio(avi_t *AVI, char *audbuf, long bytes); long AVI_read_audio_chunk(avi_t *AVI, char *audbuf); long AVI_audio_codech_offset(avi_t *AVI); long AVI_audio_codecf_offset(avi_t *AVI); long AVI_video_codech_offset(avi_t *AVI); long AVI_video_codecf_offset(avi_t *AVI); int AVI_read_data(avi_t *AVI, char *vidbuf, long max_vidbuf, char *audbuf, long max_audbuf, long *len); void AVI_print_error(char *str); char *AVI_strerror(void); char *AVI_syserror(void); int AVI_scan(char *name); int AVI_dump(char *name, int mode); char *AVI_codec2str(short cc); int AVI_file_check(char *import_file); void AVI_info(avi_t *avifile); uint64_t AVI_max_size(void); int avi_update_header(avi_t *AVI); int AVI_set_audio_track(avi_t *AVI, int track); int AVI_get_audio_track(avi_t *AVI); int AVI_audio_tracks(avi_t *AVI); void AVI_set_audio_vbr(avi_t *AVI, long is_vbr); long AVI_get_audio_vbr(avi_t *AVI); void AVI_set_comment_fd(avi_t *AVI, int fd); int AVI_get_comment_fd(avi_t *AVI); struct riff_struct { uint8_t id[4]; /* RIFF */ uint32_t len; uint8_t wave_id[4]; /* WAVE */ }; struct chunk_struct { uint8_t id[4]; uint32_t len; }; struct common_struct { uint16_t wFormatTag; uint16_t wChannels; uint32_t dwSamplesPerSec; uint32_t dwAvgBytesPerSec; uint16_t wBlockAlign; uint16_t wBitsPerSample; /* Only for PCM */ }; struct wave_header { struct riff_struct riff; struct chunk_struct format; struct common_struct common; struct chunk_struct data; }; // Simple WAV IO int AVI_read_wave_header( int fd, struct wave_header * wave ); int AVI_write_wave_header( int fd, const struct wave_header * wave ); size_t AVI_read_wave_pcm_data( int fd, void * buffer, size_t buflen ); size_t AVI_write_wave_pcm_data( int fd, const void * buffer, size_t buflen ); struct AVIStreamHeader { long fccType; long fccHandler; long dwFlags; long dwPriority; long dwInitialFrames; long dwScale; long dwRate; long dwStart; long dwLength; long dwSuggestedBufferSize; long dwQuality; long dwSampleSize; }; #endif ogmtools-1.5/avilib/avimisc.c0000644000076400234220000000655210141724010015715 0ustar mosuvj00000000000000/* * avimisc.c * * Copyright (C) Thomas Östreich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #if !defined(COMP_MSC) #include #endif #include #include #include "avilib.h" #include "xio.h" void AVI_info(avi_t *avifile) { long frames, rate, mp3rate, chunks, tot_bytes; int width, height, format, chan, bits; int j, tracks, tmp; double fps; char *codec; frames = AVI_video_frames(avifile); width = AVI_video_width(avifile); height = AVI_video_height(avifile); fps = AVI_frame_rate(avifile); codec = AVI_video_compressor(avifile); printf("[avilib] V: %6.3f fps, codec=%s, frames=%ld, width=%d, height=%d\n", fps, ((strlen(codec)==0)? "RGB": codec), frames, width, height); tracks=AVI_audio_tracks(avifile); tmp=AVI_get_audio_track(avifile); for(j=0; j0) { printf("[avilib] A: %ld Hz, format=0x%02x, bits=%d, channels=%d, bitrate=%ld kbps,\n", rate, format, bits, chan, mp3rate); printf("[avilib] %ld chunks, %ld bytes, %s\n", chunks, tot_bytes, (AVI_get_audio_vbr(avifile)?"VBR":"CBR")); } else printf("[avilib] A: no audio track found\n"); } AVI_set_audio_track(avifile, tmp); //reset } int AVI_file_check(char *import_file) { // check for sane video file struct stat fbuf; if(xio_stat(import_file, &fbuf) || import_file==NULL){ fprintf(stderr, "(%s) invalid input file \"%s\"\n", __FILE__, import_file); return(1); } return(0); } char *AVI_codec2str(short cc) { switch (cc) { case 0x1://PCM return("PCM"); break; case 0x2://MS ADPCM return("MS ADPCM"); break; case 0x11://IMA ADPCM printf("Audio in ADPCM format\n"); break; case 0x31://MS GSM 6.10 case 0x32://MSN Audio printf("Audio in MS GSM 6.10 format\n"); break; case 0x50://MPEG Layer-1,2 return("MPEG Layer-1/2"); break; case 0x55://MPEG Layer-3 return("MPEG Layer-3"); break; case 0x160: case 0x161://DivX audio return("DivX WMA"); break; case 0x401://Intel Music Coder printf("Audio in IMC format\n"); break; case 0x2000://AC3 return("AC3"); break; default: return("unknown"); } return("unknown"); } ogmtools-1.5/avilib/.cvsignore0000644000076400234220000000022407630166036016125 0ustar mosuvj00000000000000Makefile Makefile.in *.gz .deps .libs aclocal.m4 config.cache config.h config.h.in config.log config.status configure stamp-h stamp-h.in confdefs.h ogmtools-1.5/avilib/Makefile.in0000644000076400234220000002161510143371303016165 0ustar mosuvj00000000000000# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Process this file with automake to produce Makefile.in. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AVILIB_CFLAGS = @AVILIB_CFLAGS@ AVILIB_CXXFLAGS = @AVILIB_CXXFLAGS@ AVILIB_LIBS = @AVILIB_LIBS@ AWK = @AWK@ CC = @CC@ CPP = @CPP@ CXX = @CXX@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEPDIR = @DEPDIR@ DVDREAD_CFLAGS = @DVDREAD_CFLAGS@ DVDREAD_LIBS = @DVDREAD_LIBS@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ PROFILING_LIBS = @PROFILING_LIBS@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.3 foreign DEFAULT_INCLUDES = -I$(top_srcdir) -I$(srcdir) -I$(top_builddir) -I. noinst_LIBRARIES = libavi.a INCLUDES = -I./ CFLAGS = -O3 -funroll-loops -ffast-math -DLINUX -Wall @CFLAGS@ libavi_a_SOURCES = avilib.c avidump.c avimisc.c xio.c EXTRA_DIST = avilib.h README.avilib subdir = avilib mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) libavi_a_AR = $(AR) cru libavi_a_LIBADD = am_libavi_a_OBJECTS = avilib.$(OBJEXT) avidump.$(OBJEXT) \ avimisc.$(OBJEXT) xio.$(OBJEXT) libavi_a_OBJECTS = $(am_libavi_a_OBJECTS) DEFS = @DEFS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/avidump.Po ./$(DEPDIR)/avilib.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/avimisc.Po ./$(DEPDIR)/xio.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libavi_a_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(libavi_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign avilib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libavi.a: $(libavi_a_OBJECTS) $(libavi_a_DEPENDENCIES) -rm -f libavi.a $(libavi_a_AR) libavi.a $(libavi_a_OBJECTS) $(libavi_a_LIBADD) $(RANLIB) libavi.a mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avidump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avilib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avimisc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xio.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-info-am .PHONY: GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES distclean distclean-compile \ distclean-depend distclean-generic distclean-tags distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ogmtools-1.5/r_vobsub.h0000644000076400234220000000362007655160106014653 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_vobsub.h class definitions for the VobSub subtitle reader Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifdef ENABLE_VOBSUB #ifndef __R_VOBSUB_H__ #define __R_VOBSUB_H__ #include #include #include "ogmmerge.h" #include "queue.h" #include "p_vobsub.h" class vobsub_reader_c: public generic_reader_c { private: char chunk[2048]; FILE *file, *subfile; vobsub_packetizer_c *vobsub_packetizer; vobsub_packetizer_c **all_packetizers; int num_packetizers; int act_wchar; audio_sync_t async; range_t range; char **comments; public: vobsub_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~vobsub_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); private: virtual void add_vobsub_packetizer(int width, int height, char *palette, int langidx, char *id, int index); }; #endif /* __R_VOBSUB_H__*/ #endif // ENABLE_VOBSUB ogmtools-1.5/p_index.cpp0000644000076400234220000000571507655160106015022 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_index.cpp video index Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifdef ENABLE_INDEX #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "p_index.h" #include "vorbis_header_utils.h" index_packetizer_c::index_packetizer_c(int nserial) throw (error_c) : q_c() { serialno = create_unique_serial(); ogg_stream_init(&os, serialno); granulepos = 0; serial = nserial; packetno = 0; produce_header_packets(); } index_packetizer_c::~index_packetizer_c() { } void index_packetizer_c::reset() { } void index_packetizer_c::produce_header_packets() { ogg_packet op; stream_header sh; int clen, res; char *tempbuf; vorbis_comment *vc; tempbuf = (char *)malloc(sizeof(sh) + 64); if (tempbuf == NULL) die("malloc"); memset(&sh, 0, sizeof(sh)); strcpy(sh.streamtype, "index"); put_uint32(&sh.subtype[0], serial); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, 10000000); *((unsigned char *)tempbuf) = PACKET_TYPE_HEADER; memcpy((char *)&tempbuf[1], &sh, sizeof(sh)); op.packet = (unsigned char *)tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; /* submit it */ ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); /* Create the comments packet */ vc = generate_vorbis_comment(NULL); clen = -1 * comments_to_buffer(vc, NULL, 0); op.packet = (unsigned char *)tempbuf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; if ((res = comments_to_buffer(vc, (char *)op.packet, clen)) < 0) { fprintf(stderr, "FATAL: p_index: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; vorbis_comment_clear(vc); free(vc); } int index_packetizer_c::process(idx_entry *entries, int num) { ogg_packet op; char *tempbuf; tempbuf = (char *)malloc(num * sizeof(idx_entry) + 64); if (tempbuf == NULL) die("malloc"); this->serial = serial; memcpy(&tempbuf[1], entries, num * sizeof(idx_entry)); tempbuf[0] = PACKET_IS_SYNCPOINT; op.bytes = num * sizeof(idx_entry) + 1; op.packet = (unsigned char *)tempbuf; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = 0; op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); free(tempbuf); return EMOREDATA; } void index_packetizer_c::produce_eos_packet() { } stamp_t index_packetizer_c::make_timestamp(ogg_int64_t granulepos) { return 0; } #endif // ENABLE_INDEX ogmtools-1.5/os.h0000644000076400234220000000171707746421163013464 0ustar mosuvj00000000000000#ifndef __OS_H #define __OS_H #if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) # define SYS_WINDOWS # if defined __MINGW32__ # define COMP_MINGW # elif defined __CYGWIN__ # define COMP_CYGWIN # else # define COMP_MSC # endif #else # define COMP_GCC # define SYS_UNIX # if defined(__bsdi__) || defined(__FreeBSD__) # define SYS_BSD # else # define SYS_LINUX # endif #endif #if defined(COMP_MSC) # define PACKAGE "mkvtoolnix" # define VERSION "0.7.2" # define strncasecmp _strnicmp # define strcasecmp _stricmp # define nice(a) # define vsnprintf _vsnprintf # define vfprintf _vfprintf #endif // COMP_MSC #if defined(COMP_MINGW) || defined(COMP_MSC) # define LLD "%I64d" # define LLU "%I64u" #else # define LLD "%lld" # define LLU "%llu" #endif // COMP_MINGW || COMP_MSC #if !defined(COMP_CYGWIN) #include #endif // !COMP_CYGWIN #if defined(SYS_WINDOWS) # define PATHSEP '\\' #else # define PATHSEP '/' #endif #endif ogmtools-1.5/COPYING0000644000076400234220000004311007526502325013712 0ustar mosuvj00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ogmtools-1.5/p_vorbis.h0000644000076400234220000000271607605371110014654 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_vorbis.h class definition for the Vorbis audio output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __P_VORBIS_H__ #define __P_VORBIS_H__ #include "ogmmerge.h" #include "queue.h" class vorbis_packetizer_c: public q_c { private: ogg_int64_t old_granulepos; ogg_int64_t ogran; ogg_int64_t last_granulepos; ogg_int64_t last_granulepos_seen; int packetno; int skip_packets; audio_sync_t async; range_t range; vorbis_info vi; vorbis_comment vc; int range_converted; ogg_packet *header_packet; public: vorbis_packetizer_c(audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~vorbis_packetizer_c(); virtual int process(ogg_packet *op, ogg_int64_t gran); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); private: virtual void setup_displacement(); virtual int encode_silence(int fd); }; #endif /* __P_VORBIS_H__*/ ogmtools-1.5/p_video.h0000644000076400234220000000305307605371110014451 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_video.h class definition for the video output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __P_VIDEO_H #define __P_VIDEO_H #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" class video_packetizer_c: public q_c { private: char codec[5]; double fps, sample_rate; int width, height; int bpp; int max_frame_size; int packetno; ogg_int64_t last_granulepos, old_granulepos; char *tempbuf; vorbis_comment *chapter_info; range_t range; public: video_packetizer_c(char *, double, int, int, int, int, audio_sync_t *, range_t *nrange, char **ncomments) throw (error_c); virtual ~video_packetizer_c(); virtual int process(char *buf, int size, int num_frames, int key, int last_frame); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); virtual void set_chapter_info(vorbis_comment *info); private: virtual vorbis_comment *strip_chapters(); }; #endif ogmtools-1.5/.cvsignore0000644000076400234220000000035407661655043014670 0ustar mosuvj00000000000000ogmmerge ogminfo ogmdemux ogmsplit ogmcat dvdxchap *.gz .deps .libs config.cache config.h.in config.log config.status stamp-h stamp-h.in confdefs.h *.cache Makefile Makefile.in aclocal.m4 configure install-sh missing mkinstalldirs data ogmtools-1.5/vorbis_header_utils.c0000644000076400234220000001451607746030030017060 0ustar mosuvj00000000000000#include #include #include #include #include "ogmstreams.h" #include "common.h" #include "vorbis_header_utils.h" char *mmalloc(int size) { char *p = malloc(size); if (p == NULL) { fprintf(stderr, "FATAL: could not allocate %d bytes of memory.\n", size); exit(1); } memset(p, 0, size); return p; } /* * Taken from libvorbis/lib/info.c ... */ int vorbis_unpack_comment(vorbis_comment *vc, char *buf, int len) { int i, pos; int vendorlen; if (len < 7) { vorbis_comment_clear(vc); return -1; } pos = 7; if ((pos + 4) > len) { vorbis_comment_clear(vc); return -1; } // vendorlen = oggpack_read(opb,32); vendorlen = get_uint32(&buf[pos]); pos += 4; vc->vendor = mmalloc(vendorlen + 1); // _v_readstring(opb,vc->vendor,vendorlen); if ((pos + vendorlen) > len) { vorbis_comment_clear(vc); return -1; } memcpy(vc->vendor, &buf[pos], vendorlen); pos += vendorlen; // vc->comments=oggpack_read(opb,32); if ((pos + 4) > len) { vorbis_comment_clear(vc); return -1; } vc->comments = get_uint32(&buf[pos]); pos += 4; if (vc->comments < 0) { vorbis_comment_clear(vc); return -1; } vc->user_comments = (char **)mmalloc((vc->comments + 1) * sizeof(*vc->user_comments)); vc->comment_lengths = (int *)mmalloc((vc->comments + 1) * sizeof(*vc->comment_lengths)); for(i = 0; i < vc->comments; i++) { int clen; // clen = oggpack_read(opb,32); if ((pos + 4) > len) { vorbis_comment_clear(vc); return -1; } clen = get_uint32(&buf[pos]); pos += 4; if(clen < 0) { vorbis_comment_clear(vc); return -1; } vc->comment_lengths[i] = clen; vc->user_comments[i] = mmalloc(clen + 1); if ((pos + clen) > len) { vorbis_comment_clear(vc); return -1; } // _v_readstring(opb,vc->user_comments[i],len); memcpy(vc->user_comments[i], &buf[pos], clen); pos += clen; } // if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ return 0; } void vorbis_comment_remove_number(vorbis_comment *vc, int num) { char **user_comments; int *comment_lengths; if (num >= vc->comments) return; user_comments = (char **)malloc(vc->comments * sizeof(char *)); if (user_comments == NULL) die("malloc"); comment_lengths = (int *)malloc(vc->comments * sizeof(int)); if (comment_lengths == NULL) die("malloc"); free(vc->user_comments[num]); memcpy(&user_comments[0], &vc->user_comments[0], num * sizeof(char *)); memcpy(&user_comments[num], &vc->user_comments[num + 1], (vc->comments - num) * sizeof(char *)); memcpy(&comment_lengths[0], &vc->comment_lengths[0], num * sizeof(int)); memcpy(&comment_lengths[num], &vc->comment_lengths[num + 1], (vc->comments - num) * sizeof(int)); free(vc->user_comments); free(vc->comment_lengths); vc->user_comments = user_comments; vc->comment_lengths = comment_lengths; vc->comments--; if (vc->user_comments[vc->comments] != NULL) { fprintf(stderr, "DBG: nn\n"); } } void vorbis_comment_remove_tag(vorbis_comment *vc, char *tag) { int i, done; char *cmp; cmp = (char *)malloc(strlen(tag) + 2); if (cmp == NULL) die("malloc"); sprintf(cmp, "%s=", tag); do { done = 1; for (i = 0; i < vc->comments; i++) if (!strncmp(vc->user_comments[i], cmp, strlen(cmp))) { free(cmp); vorbis_comment_remove_number(vc, i); done = 0; break; } } while (!done); free(cmp); } vorbis_comment *vorbis_comment_dup(vorbis_comment *vc) { vorbis_comment *new_vc; int i; if (vc == NULL) return NULL; new_vc = (vorbis_comment *)malloc(sizeof(vorbis_comment)); if (new_vc == NULL) die("malloc"); memcpy(new_vc, vc, sizeof(vorbis_comment)); new_vc->user_comments = (char **)malloc((vc->comments + 1) * sizeof(char *)); new_vc->comment_lengths = (int *)malloc((vc->comments + 1) * sizeof(int)); if ((new_vc->user_comments == NULL) || (new_vc->comment_lengths == NULL)) die("malloc"); for (i = 0; i < vc->comments; i++) new_vc->user_comments[i] = strdup(vc->user_comments[i]); new_vc->user_comments[vc->comments] = 0; memcpy(new_vc->comment_lengths, vc->comment_lengths, (vc->comments + 1) * sizeof(char *)); new_vc->vendor = strdup(vc->vendor); return new_vc; } vorbis_comment *vorbis_comment_cat(vorbis_comment *dst, vorbis_comment *src) { int i; if (dst == NULL) return vorbis_comment_dup(src); if (src == NULL) return dst; for (i = 0; i < src->comments; i++) vorbis_comment_add(dst, src->user_comments[i]); return dst; } int comments_to_buffer(vorbis_comment *vc, char *tempbuf, int len) { int vclen, i, pos; // PACKET_TYPE_COMMENT, "vorbis", vendor_field_len, strlen(vendor), // comments vclen = 1 + 6 + 4 + strlen(vc->vendor) + 4; for (i = 0; i < vc->comments; i++) vclen += 4 + strlen(vc->user_comments[i]); vclen++; if (vclen > len) return -1 * vclen; *((unsigned char *)tempbuf) = PACKET_TYPE_COMMENT; strcpy(&tempbuf[1], "vorbis"); pos = 7; put_uint32(&tempbuf[pos], strlen(vc->vendor)); pos += 4; strcpy(&tempbuf[pos], vc->vendor); pos += strlen(vc->vendor); put_uint32(&tempbuf[pos], vc->comments); pos += 4; for (i = 0; i < vc->comments; i++) { put_uint32(&tempbuf[pos], strlen(vc->user_comments[i])); pos += 4; strcpy(&tempbuf[pos], vc->user_comments[i]); pos += strlen(vc->user_comments[i]); } *((unsigned char *)&tempbuf[pos]) = 1; return vclen; } vorbis_comment *generate_vorbis_comment(char **s) { vorbis_comment *vc; int nc, i; vc = (vorbis_comment *)mmalloc(sizeof(vorbis_comment)); vc->vendor = strdup(VERSIONINFO); if ((s == NULL) || (s[0] == NULL)) { vc->user_comments = (char **)mmalloc(sizeof(char *)); vc->comment_lengths = (int *)mmalloc(sizeof(int)); vc->comments = 0; } else { for (nc = 0; s[nc] != NULL; nc++) ; vc->comment_lengths = (int *)mmalloc(sizeof(int) * (nc + 1)); vc->user_comments = (char **)mmalloc(sizeof(char *) * (nc + 1)); for (i = 0; i < nc; i++) { vc->comment_lengths[i] = strlen(s[i]); vc->user_comments[i] = strdup(s[i]); if (vc->user_comments[i] == NULL) die("strdup"); } vc->comments = nc; } return vc; } ogmtools-1.5/r_srt.h0000644000076400234220000000263707655160106014172 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_srt.h class definitions for the SRT text subtitle reader Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_SRT_H__ #define __R_SRT_H__ #include #include #include "ogmmerge.h" #include "queue.h" #include "p_textsubs.h" class srt_reader_c: public generic_reader_c { private: char chunk[2048]; FILE *file; textsubs_packetizer_c *textsubspacketizer; int act_wchar; public: srt_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~srt_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); }; #endif /* __R_SRT_H__*/ ogmtools-1.5/p_textsubs.cpp0000644000076400234220000001567207746031661015603 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_textsubs.cpp text subtitle output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "ogmstreams.h" #include "p_textsubs.h" #include "vorbis_header_utils.h" textsubs_packetizer_c::textsubs_packetizer_c(audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) : q_c() { serialno = create_unique_serial(); ogg_stream_init(&os, serialno); packetno = 0; memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); range.start *= 1000; range.end *= 1000; eos_packet_created = 0; comments = generate_vorbis_comment(ncomments); old_granulepos = 0; last_granulepos = 0; } textsubs_packetizer_c::~textsubs_packetizer_c() { ogg_stream_clear(&os); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } } void textsubs_packetizer_c::produce_header_packets() { ogg_packet op; stream_header sh; int clen, res; char *tempbuf; memset(&sh, 0, sizeof(sh)); strcpy(sh.streamtype, "text"); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, 10000); put_uint64(&sh.samples_per_unit, 1); put_uint32(&sh.default_len, 1); put_uint32(&sh.buffersize, 16384); tempbuf = (char *)malloc(sizeof(sh) + 1); if (tempbuf == NULL) die("malloc"); *tempbuf = PACKET_TYPE_HEADER; memcpy(&tempbuf[1], &sh, sizeof(sh)); op.packet = (unsigned char *)tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; /* submit it */ ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); free(tempbuf); /* Create the comments packet */ clen = -1 * comments_to_buffer(comments, NULL, 0); tempbuf = (char *)malloc(clen); if (tempbuf == NULL) die("malloc"); op.packet = (unsigned char *)tempbuf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; if ((res = comments_to_buffer(comments, (char *)op.packet, clen)) < 0) { fprintf(stderr, "FATAL: p_textsubs: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; free(tempbuf); last_granulepos = 0; } void textsubs_packetizer_c::reset() { } int textsubs_packetizer_c::process(ogg_int64_t start, ogg_int64_t end, char *_subs, int last_sub) { ogg_packet op; char *tempbuf; int clen, i, idx, num_newlines; unsigned char *bptr; char *subs, *idx1, *idx2; if (packetno == 0) produce_header_packets(); if (eos_packet_created) return 0; // Adjust the start and end values according to the audio adjustment. start += async.displacement; start = (ogg_int64_t)(async.linear * start); end += async.displacement; end = (ogg_int64_t)(async.linear * end); /* * Now adjust and check the range. If the end is < 0 then it is definitely * too early. */ start -= (ogg_int64_t)range.start; end -= (ogg_int64_t)range.start; if (end < 0) { if (last_sub) { produce_eos_packet(); return 0; } else return EMOREDATA; } // If the start is > the range end the packet is too late. if ((range.end > 0) && (start > (range.end - range.start))) { if (last_sub || !eos_packet_created) { produce_eos_packet(); return 0; } else return EMOREDATA; } // At least part of the subtitle packet must be shown. if (start < 0) start = 0; if ((range.end > 0) && (end > (range.end - range.start))) end = (ogg_int64_t)(range.end - range.start); /* * First create the 'empty' subtitle packet. Take the difference between * the current start and its old position as its duration. */ if (!omit_empty_packets) { clen = start - last_granulepos; for (i = 3; i >= 0; i--) if (clen > (1 << (8 * i))) break; i++; tempbuf = (char *)malloc(1 + i + 1); tempbuf[i + 1] = 0; tempbuf[0] = (((i & 3) << 6) + ((i & 4) >> 1)) | PACKET_IS_SYNCPOINT; bptr = (unsigned char *)&tempbuf[1]; for (idx = 0; idx < i; idx++) { *(bptr + idx) = (unsigned char)(clen & 0xFF); clen >>= 8; } op.packet = (unsigned char *)tempbuf; op.bytes = i + 2; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = last_granulepos; op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); free(tempbuf); } clen = end - start; for (i = 3; i >= 0; i--) if (clen > (1 << (8 * i))) break; i++; idx1 = _subs; subs = NULL; num_newlines = 0; while (*idx1 != 0) { if (*idx1 == '\n') num_newlines++; idx1++; } subs = (char *)malloc(strlen(_subs) + num_newlines * 2 + 2); if (subs == NULL) die("malloc"); idx1 = _subs; idx2 = subs; while (*idx1 != 0) { if (*idx1 == '\n') { *idx2 = '\r'; idx2++; *idx2 = '\n'; idx2++; } else if (*idx1 != '\r') { *idx2 = *idx1; idx2++; } idx1++; } *idx2 = 0; if (idx2 != subs) { idx2--; while ((idx2 != subs) && ((*idx2 == '\n') || (*idx2 == '\r'))) { *idx2 = 0; idx2--; } } tempbuf = (char *)malloc(strlen(subs) + i + 2); memcpy((char *)&tempbuf[i + 1], subs, strlen(subs) + 1); tempbuf[0] = (((i & 3) << 6) + ((i & 4) >> 1)) | PACKET_IS_SYNCPOINT; bptr = (unsigned char *)&tempbuf[1]; for (idx = 0; idx < i; idx++) { *(bptr + idx) = (unsigned char)(clen & 0xFF); clen >>= 8; } op.packet = (unsigned char *)tempbuf; op.bytes = strlen(subs) + i + 2; op.b_o_s = 0; op.e_o_s = last_sub; op.granulepos = start; op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); free(tempbuf); last_granulepos = end; free(subs); return EMOREDATA; } void textsubs_packetizer_c::produce_eos_packet() { ogg_packet op; char tempbuf[4]; tempbuf[0] = (1 << 6) | PACKET_IS_SYNCPOINT; tempbuf[1] = (char)1; tempbuf[2] = ' '; tempbuf[3] = 0; op.packet = (unsigned char *)tempbuf; op.bytes = 4; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = last_granulepos; op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); eos_packet_created = 1; } stamp_t textsubs_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef XIPHCORRECTINTERLEAVING stamp = granulepos * 1000; #else stamp = old_granulepos * 1000; #endif old_granulepos = granulepos; return stamp; } ogmtools-1.5/r_avi.cpp0000644000076400234220000004217310037021763014464 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_avi.cpp AVI demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include extern "C" { #include } #include "ogmmerge.h" #include "queue.h" #include "r_avi.h" #include "p_video.h" #include "p_pcm.h" #include "p_mp3.h" #include "p_ac3.h" int avi_reader_c::probe_file(FILE *file, off_t size) { char data[12]; if (size < 12) return 0; fseeko(file, 0, SEEK_SET); if (fread(data, 1, 12, file) != 12) { fseeko(file, 0, SEEK_SET); return 0; } fseeko(file, 0, SEEK_SET); if(strncasecmp(data, "RIFF", 4) || strncasecmp(data+8, "AVI ", 4)) return 0; return 1; } /* allocates and initializes local storage for a particular * substream conversion. * */ avi_reader_c::avi_reader_c(char *fname, unsigned char *astreams, unsigned char *vstreams, audio_sync_t *nasync, range_t *nrange, char **ncomments, char *nfourcc, char* nav_seek) throw (error_c) { int fsize, i; off_t size; FILE *f; int extract_video = 1; avi_demuxer_t *demuxer; char *codec; if (fname == NULL) throw error_c("avi_reader: fname == NULL !?"); if ((f = fopen(fname, "r")) == NULL) throw error_c("avi_reader: Could not open source file."); if (fseeko(f, 0, SEEK_END) != 0) throw error_c("avi_reader: Could not seek to end of file."); size = ftello(f); if (fseeko(f, 0, SEEK_SET) != 0) throw error_c("avi_reader: Could not seek to beginning of file."); if (!avi_reader_c::probe_file(f, size)) throw error_c("avi_reader: Source is not a valid AVI file."); fclose(f); if (verbose) fprintf(stderr, "Using AVI demultiplexer for %s. Opening file. This " "may take some time depending on the file's size.\n", fname); if (nav_seek == NULL) avi = AVI_open_input_file(fname, 1); else avi = AVI_open_input_indexfile(fname, 0, nav_seek); if (avi == NULL) { const char *msg = "avi_reader: Could not initialize AVI source. Reason: "; char *s, *error; error = AVI_strerror(); s = (char *)malloc(strlen(msg) + strlen(error) + 1); if (s == NULL) die("malloc"); sprintf(s, "%s%s", msg, error); throw error_c(s); } if (astreams != NULL) this->astreams = (unsigned char *)strdup((char *)astreams); else this->astreams = NULL; if (vstreams != NULL) this->vstreams = (unsigned char *)strdup((char *)vstreams); else this->vstreams = NULL; this->nav_seek = nav_seek; if (ncomments == NULL) comments = ncomments; else comments = dup_comments(ncomments); fps = AVI_frame_rate(avi); if (video_fps < 0) video_fps = fps; frames = 0; fsize = 0; maxframes = AVI_video_frames(avi); for (i = 0; i < maxframes; i++) if (AVI_frame_size(avi, i) > fsize) fsize = AVI_frame_size(avi, i); max_frame_size = fsize; if (vstreams != NULL) { extract_video = 0; for (i = 0; i < strlen((char *)vstreams); i++) { if (vstreams[i] > 1) fprintf(stderr, "Warning: avi_reader: only one video stream per AVI " \ "is supported. Will not ignore -d %d.\n", vstreams[i]); else if (vstreams[i] == 1) extract_video = 1; } } if (extract_video) { codec = AVI_video_compressor(avi); if (!strcasecmp(codec, "DIV3") || !strcasecmp(codec, "AP41") || // Angel Potion !strcasecmp(codec, "MPG3") || !strcasecmp(codec, "MP43")) is_divx = RAVI_DIVX3; else if (!strcasecmp(codec, "MP42") || !strcasecmp(codec, "DIV2") || !strcasecmp(codec, "DIVX") || !strcasecmp(codec, "XVID") || !strcasecmp(codec, "DX50")) is_divx = RAVI_MPEG4; else is_divx = 0; if (nfourcc != NULL) codec = nfourcc; vpacketizer = new video_packetizer_c(codec, AVI_frame_rate(avi), AVI_video_width(avi), AVI_video_height(avi), 24, // fixme! fsize, NULL, nrange, comments); if (verbose) fprintf(stderr, "+-> Using video output module for video stream.\n"); } else vpacketizer = NULL; memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); ademuxers = NULL; if (astreams != NULL) { // use only specific audio streams (or none at all) for (i = 0; i < strlen((char *)astreams); i++) { if (astreams[i] > AVI_audio_tracks(avi)) fprintf(stderr, "Warning: avi_reader: the AVI does not contain an " \ "audio stream with the id %d. Number of audio streams: %d\n", astreams[i], AVI_audio_tracks(avi)); else { int already_extracting = 0; avi_demuxer_t *demuxer = ademuxers; while (demuxer) { if (demuxer->aid == astreams[i]) { already_extracting = 1; break; } demuxer = demuxer->next; } if (already_extracting) fprintf(stderr, "Warning: avi_reader: already extracting audio " \ "stream number %d. Will only do this once.\n", astreams[i]); else add_audio_demuxer(avi, astreams[i] - 1); } } } else // use all audio streams (no parameter specified) for (i = 0; i < AVI_audio_tracks(avi); i++) add_audio_demuxer(avi, i); demuxer = ademuxers; while (demuxer != NULL) { long bps = demuxer->samples_per_second * demuxer->channels * demuxer->bits_per_sample / 8; if (bps > fsize) fsize = bps; demuxer = demuxer->next; } max_frame_size = fsize; chunk = (char *)malloc(fsize); if (chunk == NULL) die("malloc"); act_wchar = 0; old_key = 0; old_chunk = NULL; video_done = 0; } avi_reader_c::~avi_reader_c() { struct avi_demuxer_t *demuxer, *tmp; if (astreams != NULL) free(astreams); if (vstreams != NULL) free(vstreams); if (avi != NULL) AVI_close(avi); if (chunk != NULL) free(chunk); if (vpacketizer != NULL) delete vpacketizer; demuxer = ademuxers; while (demuxer) { if (demuxer->packetizer != NULL) delete demuxer->packetizer; tmp = demuxer->next; free(demuxer); demuxer = tmp; } if (comments != NULL) free_comments(comments); if (old_chunk != NULL) free(old_chunk); } int avi_reader_c::add_audio_demuxer(avi_t *avi, int aid) { avi_demuxer_t *demuxer, *append_to; append_to = ademuxers; while ((append_to != NULL) && (append_to->next != NULL)) append_to = append_to->next; AVI_set_audio_track(avi, aid); demuxer = (avi_demuxer_t *)malloc(sizeof(avi_demuxer_t)); if (demuxer == NULL) die("malloc"); memset(demuxer, 0, sizeof(avi_demuxer_t)); demuxer->aid = aid; switch (AVI_audio_format(avi)) { case 0x0001: // raw PCM audio if (verbose) fprintf(stdout, "+-> Using PCM output module for audio stream %d.\n", aid + 1); demuxer->samples_per_second = AVI_audio_rate(avi); demuxer->channels = AVI_audio_channels(avi); demuxer->bits_per_sample = AVI_audio_bits(avi); demuxer->packetizer = new pcm_packetizer_c(demuxer->samples_per_second, demuxer->channels, demuxer->bits_per_sample, &async, &range, comments); break; case 0x0055: // MP3 if (verbose) fprintf(stdout, "+-> Using MP3 output module for audio stream %d.\n", aid + 1); demuxer->samples_per_second = AVI_audio_rate(avi); demuxer->channels = AVI_audio_channels(avi); demuxer->bits_per_sample = AVI_audio_mp3rate(avi); demuxer->packetizer = new mp3_packetizer_c(demuxer->samples_per_second, demuxer->channels, demuxer->bits_per_sample, &async, &range, comments); break; case 0x2000: // AC3 if (verbose) fprintf(stdout, "+-> Using AC3 output module for audio stream %d.\n", aid + 1); demuxer->samples_per_second = AVI_audio_rate(avi); demuxer->channels = AVI_audio_channels(avi); demuxer->bits_per_sample = AVI_audio_mp3rate(avi); demuxer->packetizer = new ac3_packetizer_c(demuxer->samples_per_second, demuxer->channels, demuxer->bits_per_sample, &async, &range, comments); break; default: fprintf(stderr, "Error: Unknown audio format 0x%04x for audio stream " \ "%d.\n", AVI_audio_format(avi), aid + 1); return -1; } if (append_to == NULL) ademuxers = demuxer; else append_to->next = demuxer; return 0; } #define VOS_STARTCODE 0xb0 #define VOP_STARTCODE 0xb6 int avi_reader_c::is_keyframe(unsigned char *data, long size, int suggestion) { int i; // if (!rederive_keyframes) // return suggestion; switch (is_divx) { // case RAVI_DIVX3: // i = *((int *)data); // return ((i & 0x40000000) ? 0 : 1); case RAVI_MPEG4: for(i=0; i < size - 5; i++) { if ((data[i] == 0x00) && (data[i + 1] == 0x00) && (data[i + 2] == 0x01)) { if ((data[i + 3] == 0x00) || (data[i + 3] == VOS_STARTCODE)) return 1; if (data[i + 3] == VOP_STARTCODE) { if ((data[i + 4] & 0xc0) == 0) return 1; else return 0; } i += 2; } return suggestion; } default: return suggestion; } } int avi_reader_c::read() { int nread, key, last_frame; avi_demuxer_t *demuxer; int need_more_data; int done, frames_read; need_more_data = 0; if ((vpacketizer != NULL) && !video_done) { if (frames == 0) vpacketizer->set_chapter_info(chapter_info); last_frame = 0; while (!vpacketizer->page_available() && !last_frame) { done = 0; // Make sure we have a frame to work with. if (old_chunk == NULL) { nread = AVI_read_frame(avi, (char *)chunk, &key); if (nread > max_frame_size) { fprintf(stderr, "FATAL: r_avi: nread (%d) > max_frame_size (%d)\n", nread, max_frame_size); exit(1); } if (nread < 0) { vpacketizer->flush_pages(); frames = maxframes + 1; break; } key = is_keyframe((unsigned char *)chunk, nread, key); old_chunk = (char *)malloc(nread); if (old_chunk == NULL) die("malloc"); memcpy(old_chunk, chunk, nread); old_key = key; old_nread = nread; frames++; } frames_read = 1; done = 0; // Check whether we have identical frames while (!done && (frames <= (maxframes - 1))) { nread = AVI_read_frame(avi, (char *)chunk, &key); if (nread > max_frame_size) { fprintf(stderr, "FATAL: r_avi: nread (%d) > max_frame_size (%d)\n", nread, max_frame_size); exit(1); } if (nread < 0) { vpacketizer->process(old_chunk, old_nread, frames_read, old_key, 1); frames = maxframes + 1; break; } key = is_keyframe((unsigned char *)chunk, nread, key); if (frames == (maxframes - 1)) { last_frame = 1; done = 1; } if (nread == 0) frames_read++; else if (nread > 0) done = 1; frames++; } if (nread > 0) { vpacketizer->process(old_chunk, old_nread, frames_read, old_key, 0); if (! last_frame) { if (old_chunk != NULL) free(old_chunk); if (nread == 0) fprintf(stdout, "hmm\n"); old_chunk = (char *)malloc(nread); if (old_chunk == NULL) die("malloc"); memcpy(old_chunk, chunk, nread); old_key = key; old_nread = nread; } else if (nread > 0) vpacketizer->process(chunk, nread, 1, key, 1); } } if (last_frame) { vpacketizer->flush_pages(); frames = maxframes + 1; video_done = 1; } else if (frames != (maxframes + 1)) need_more_data = 1; } demuxer = ademuxers; while (demuxer != NULL) { while (!demuxer->eos && !demuxer->packetizer->page_available()) { AVI_set_audio_track(avi, demuxer->aid); switch (AVI_audio_format(avi)) { case 0x0001: // raw PCM nread = AVI_read_audio(avi, chunk, demuxer->samples_per_second * demuxer->channels * demuxer->bits_per_sample / 8); if (nread <= 0) { demuxer->eos = 1; *chunk = 1; ((pcm_packetizer_c *)demuxer->packetizer)->process(chunk, 1, 1); demuxer->packetizer->flush_pages(); } else ((pcm_packetizer_c *)demuxer->packetizer)->process(chunk, nread, 0); break; case 0x0055: // MP3 nread = AVI_read_audio_chunk(avi, NULL); if (nread > max_frame_size) { chunk = (char *)realloc(chunk, max_frame_size); max_frame_size = nread; } nread = AVI_read_audio_chunk(avi, chunk); if (nread <= 0) { demuxer->eos = 1; demuxer->packetizer->produce_eos_packet(); demuxer->packetizer->flush_pages(); } else ((mp3_packetizer_c *)demuxer->packetizer)->process(chunk, nread, 0); break; case 0x2000: // AC3 nread = AVI_read_audio_chunk(avi, NULL); if (nread > max_frame_size) { chunk = (char *)realloc(chunk, max_frame_size); max_frame_size = nread; } nread = AVI_read_audio_chunk(avi, chunk); if (nread <= 0) { demuxer->eos = 1; demuxer->packetizer->produce_eos_packet(); demuxer->packetizer->flush_pages(); } else { ((ac3_packetizer_c *)demuxer->packetizer)->process(chunk, nread, 0); demuxer->bytes_processed += nread; } break; } } if (!demuxer->eos) need_more_data = 1; demuxer = demuxer->next; } if (need_more_data) return EMOREDATA; else return 0; } int avi_reader_c::serial_in_use(int serial) { avi_demuxer_t *demuxer; if ((vpacketizer != NULL) && (vpacketizer->serial_in_use(serial))) return 1; demuxer = ademuxers; while (demuxer != NULL) { if (demuxer->packetizer->serial_in_use(serial)) return 1; demuxer = demuxer->next; } return 0; } ogmmerge_page_t *avi_reader_c::get_header_page(int header_type) { ogmmerge_page_t *ompage = NULL; avi_demuxer_t *demuxer; if (vpacketizer) { ompage = vpacketizer->get_header_page(header_type); if (ompage != NULL) return ompage; } demuxer = ademuxers; while (demuxer != NULL) { if (demuxer->packetizer != NULL) { ompage = demuxer->packetizer->get_header_page(header_type); if (ompage != NULL) return ompage; } demuxer = demuxer->next; } return NULL; } ogmmerge_page_t *avi_reader_c::get_page() { generic_packetizer_c *winner; avi_demuxer_t *demuxer; winner = NULL; if ((vpacketizer != NULL) && (vpacketizer->page_available())) winner = vpacketizer; demuxer = ademuxers; while (demuxer != NULL) { if (winner == NULL) { if (demuxer->packetizer->page_available()) winner = demuxer->packetizer; } else if (winner->page_available() && (winner->get_smallest_timestamp() > demuxer->packetizer->get_smallest_timestamp())) winner = demuxer->packetizer; demuxer = demuxer->next; } if (winner != NULL) return winner->get_page(); else return NULL; } int avi_reader_c::display_priority() { if (vpacketizer != NULL) return DISPLAYPRIORITY_HIGH; else return DISPLAYPRIORITY_LOW; } void avi_reader_c::reset() { avi_demuxer_t *demuxer; if (vpacketizer != NULL) vpacketizer->reset(); demuxer = ademuxers; while (demuxer != NULL) { demuxer->packetizer->reset(); demuxer = demuxer->next; } } static char wchar[] = "-\\|/-\\|/-"; void avi_reader_c::display_progress() { if (vpacketizer != NULL) { int myframes = frames; if (frames == (maxframes + 1)) myframes--; fprintf(stdout, "progress: %d/%ld frames (%ld%%)\r", myframes, AVI_video_frames(avi), myframes * 100 / AVI_video_frames(avi)); } else { fprintf(stdout, "working... %c\r", wchar[act_wchar]); act_wchar++; if (act_wchar == strlen(wchar)) act_wchar = 0; } fflush(stdout); } ogmtools-1.5/TODO0000644000076400234220000000007410037022102013326 0ustar mosuvj00000000000000No features planned. OGM is pretty much fixed as it is now. ogmtools-1.5/vorbis_header_utils.h0000644000076400234220000000120207605371110017052 0ustar mosuvj00000000000000#ifndef __VORBIS_HEADER_UTILS_H #define __VORBIS_HEADER_UTILS_H #include #ifdef __cplusplus extern "C" { #endif char *mmalloc(int size); int vorbis_unpack_comment(vorbis_comment *vc, char *buf, int len); void vorbis_comment_remove_tag(vorbis_comment *vc, char *tag); void vorbis_comment_remove_number(vorbis_comment *vc, int num); vorbis_comment *vorbis_comment_dup(vorbis_comment *vc); vorbis_comment *vorbis_comment_cat(vorbis_comment *dst, vorbis_comment *src); vorbis_comment *generate_vorbis_comment(char **s); int comments_to_buffer(vorbis_comment *vc, char *tempbuf, int len); #ifdef __cplusplus } #endif #endif ogmtools-1.5/p_pcm.h0000644000076400234220000000265407605371110014130 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_pcm.h class definition for the PCM output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __P_PCM_H #define __P_PCM_H #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" class pcm_packetizer_c: public q_c { private: int packetno; int bps; u_int64_t bytes_output; unsigned long samples_per_sec; int channels; int bits_per_sample; char *tempbuf; audio_sync_t async; range_t range; ogg_int64_t old_granulepos; public: pcm_packetizer_c(unsigned long nsamples_per_sec, int nchannels, int nbits_per_sample, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~pcm_packetizer_c(); virtual int process(char *buf, int size, int last_frame); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); }; const int pcm_interleave = 16; #endif ogmtools-1.5/configure.in0000644000076400234220000000150410143371176015166 0ustar mosuvj00000000000000dnl process this file with autoconf to generate the configure script AC_INIT(ogmmerge.cpp) AM_INIT_AUTOMAKE(ogmtools,1.5) AC_PROG_CC AC_PROG_CXX AC_PROG_GCC_TRADITIONAL AC_PROG_CPP AC_PROG_RANLIB XIPH_PATH_OGG() XIPH_PATH_VORBIS() PATH_AVILIB() PATH_DEBUG() PATH_PROFILING() dnl dnl libdvdread support dnl have_dvdread=no AM_PATH_LIBDVDREAD(AC_DEFINE(HAVE_LIBDVDREAD)) AM_CONDITIONAL(HAVE_LIBDVDREAD, test x"$have_dvdread" = "xyes") AC_CHECK_FUNCS(fseeko) if test x${ac_cv_func_fseeko} != xyes; then AC_DEFINE(NEED_FSEEKO) fi dnl Check for headers AC_HEADER_STDC() CFLAGS="-Wall -Wno-sign-compare @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AVILIB_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@" CXXFLAGS="-Wall -Wno-sign-compare @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AVILIB_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@" AC_OUTPUT(Makefile avilib/Makefile) ogmtools-1.5/ChangeLog0000644000076400234220000002743610143370704014437 0ustar mosuvj000000000000002004-11-07 Moritz Bunkus * released v1.4.2. - dvdxchap accepts a range of chapters to output and adjusts the timestamps. Patch by Olivier Rolland. - ogmcat accepts files that contain a single track whose serial nubmers don't match. This is the case for audio-only Ogg files. 2004-08-03 Moritz Bunkus * released v1.4.1. - Updated avilib to handle OpenDML AVIs bigger than 1Gb created by mencoder. 2004-04-14 Moritz Bunkus * released v1.4. - The MPEG4 key frame detection was broken resulting in unseekable files. 2004-04-13 Andre Hinrichs - Fixed some typos. 2004-04-05 Moritz Bunkus * released v1.3. 2004-04-01 Moritz Bunkus - Added an option for using external AVI index files as generated by transcode's aviindex tool (patch by Andrew de Quincey). - Always regenerate key frames for AVI files if it's a MPEG4 codec. 2004-03-29 Moritz Bunkus - Updated avilib from transcode's current CVS version. 2004-02-10 Moritz Bunkus - Fixed a bug with the '-T' option to ogmmerge and following SRT files. 2003-12-15 Andre Hinrichs - Output files of ogmdemux are written to current directory. 2003-11-20 Moritz Bunkus * released v1.2. - Implemented reading older OGM files with the broken stream headers produced by ogmmerge < 1.1. Re-merging should be enough to fix the headers. 2003-11-12 Moritz Bunkus - Improved MP3 and AC3 detection. 2003-10-28 Moritz Bunkus * released v1.1. - ogmdemux skips empty packets in the text subtitle streams. 2003-10-23 Moritz Bunkus - Updated the avilib to the latest version from mkvtoolnix which in turn is a slightly modified version from transcode 0.6.10. It should be able to handle OpenDML AVIs. - Added a --summary option to ogminfo which will display the size, bitrate, number of packets/frames and total length in seconds for each track. - Added an option, --omit-empty-packets, that will suppress the creation of empty subtitle packets. - When splitting files the second and all following files have a new chapter entry starting at 00:00:00 which is marked with "(continued)". Patch by Marco Zühlke . - Improved OS/X and BSD/OS compatibility (thanks for the patch to Steven M. Schultz ). - Fixed the OGM stream headers again - they wouldn't play back on Windows, and they would be broken on big endian systems. 2003-05-20 Moritz Bunkus * released v1.0.3 - Fixed a bug in avilib. 2003-05-05 Moritz Bunkus * released v1.0.2 2003-05-04 Moritz Bunkus - Imported changes that make the ogmtools compile and work under FreeBSD (and possibly under other BSD variants as well); patch by Andrew Williams . 2003-05-01 Moritz Bunkus - Lots of fixes for endian handling (thanks for the large patch to Andreas Schwab ). 2003-04-25 Moritz Bunkus - Fixed a segfault in ogmdemux (thanks to Tilmann Bitterberg). - Made the OGM reader more error resiliant if the file is damaged. 2003-03-04 Moritz Bunkus - Fixed a bug in the subtitle packager which would discard the last character on each subtitle entry. 2003-03-01 Moritz Bunkus * released v1.0.0 - Newlines in subtitles are converted to DOS style newlines (\r\n) as some Windows players (e.g. BSPlayer) do not cope with a single \n. - ogminfo in verbosity mode 2 or above also shows the bitrate in kbit/s and KB/s for each stream. 2003-01-21 Moritz Bunkus - Some small speedups in the AVI reader. 2003-01-14 Moritz Bunkus * released v0.973 - Hopefully fixed some timestamp issues with the autotools stuff. 2003-01-13 Moritz Bunkus - Added support for MicroDVD subtitles. 2003-01-03 Moritz Bunkus * released v0.972 - Added new comment handling for ogmmerge (see man page search for '-c'). 2002-12-14 Moritz Bunkus - Fixed a bug in ogmdemux which would segfault if its output files could not be opened (thanks to Nicolas Vignal ). 2002-12-13 Moritz Bunkus - Fixed a bug in avilib that causes more calls to read/seek than necessary (fix contributed by Peter Niemayer ). * released v0.970 - Fixed a bug in ogmsplit's command line parser: '-s' was misinterpreted if an unit other than 'b' was appended to the size. - Fixed a bug in ogmmerge with stream selection when reading from an OGM: "-a 1" would work, but "-a 2" (and higher, same for video/text streams) would not. - Changed ogminfo's output to include the stream's serial number instead of the total number of streams found so far. 2002-11-30 Moritz Bunkus - Fixed another bug in ogmdemux where not enough memory was allocated for filenames (thanks to Robert Wal ). - Fixed a bug in ogmmerge: -T was not reset once used (thanks to Rober Wal ). 2002-11-23 Moritz Bunkus - Modified the verbosity levels ogminfo supports (see man page for a full listing). 2002-11-19 Moritz Bunkus - Added new program 'ogmcat' that can concatenate several OGG/OGM files into one file using various methods to keep audio/video synchronization. 2002-11-13 Moritz Bunkus * released v0.960 - Added MP3 audio synchronization. - Moved the AC3 audio synchronization code from the AC3 reader to the AC3 packetizer. Otherwise synchronization worked only if the source was AC3 files, not for e.g. AVIs or OGMs. - Added a new option '-f' to ogmmerge that can be used to force the video FourCC to a specific value (thanks to Robert Wal for the suggestion). - Fixed a bug in ogmmerge: chapter information was dropped if the source was an OGM file (thanks to Robert Wal ). - Fixed a bug in ogmmerge: if badly formatted subtitles were reported trash was shown at the end of the shortened entries (thanks to Robert Wal ). - Fixed a bug in ogmdemux: too few characters were allocated for file names resulting in file names that contained garbage (thanks to... well, just guess ;)... Robert Wal ). 2002-10-24 Moritz Bunkus * released v0.954 - Applied a patch by Kresimir Kukulj that relaxes the SRT recognition a bit - the chapter strings do not have to start with CHAPTER01= anymore. The numbers may be higher. 2002-10-19 Moritz Bunkus - Applied a patch by Peter Niemayer that enables AC3 sync by removing/duplicating whole AC3 packets. - Added 'nice(2)' to all programs :) - Fixed several number format bugs in the subtitle processor. - The Vorbis packetizer no longer forces flushing of pages. This removes unwanted 'popping' noise in some rare cases. - Fixed the output of ogminfo's -v -v mode: it now reports the exact position on which a new OGG page begins along with its length. 2002-10-01 Moritz Bunkus * released v0.951 - ogmsplit now honors the user's choice of file extensions and reuses either the extension given with -o or, if no -o is present, the input file's extension. Only if the name given with -o contains no extension '.ogm' is used. All other utilities do not append any extension on their own. 2002-09-30 Moritz Bunkus * released v0.950 - Added support for chapter information as generated by 'dvdxchap' and other Windows programs to ogmmerge and ogmsplit. 2002-09-29 Moritz Bunkus - Fixed the 'cut mode' so it will end after the given time, which does not have to be at a key frame boundary. - Added progress output to ogmsplit (only if no verbose output is wanted). 2002-09-23 Moritz Bunkus - Committed a patch to ogmsplit written by Adam Sampson that adds a 'cut mode' to ogmsplit (see man page). - Added RPM spec file contributed by Marc Lavallée . 2002-09-22 Moritz Bunkus - Introduced a first pass that finds split points in ogmsplit. This will of course lengthen the splitting process, but it is necessary in order to handle chapter information correctly. 2002-09-18 Moritz Bunkus - Cleanups for the man pages and each program's --help output. - Added new program 'dvdxchap' that can extract chapter information from DVDs and print them in a format that can be used with ogmmerge. 2002-09-17 Moritz Bunkus - Documentation moved from README to the man pages. 2002-09-16 Moritz Bunkus * released v0.93 - Added option '-p' to ogmsplit that causes ogmsplit just to print the time stamp and output position just before each key frame. - Support for AC3 audio from external files, AVI and OGM files. Still needs testing. - Tobias Waldvogel (author off OggDS) convinced me that subtitle page's granulepos values are correct the way they are now. Please ignore the '...(buggy) OggDS behaviour' mentioned below. - Comitted a patch from Jason Lunz which updates some of the Debian files. 2002-09-14 Moritz Bunkus * released v0.922 - Changed the video packet output: each keyframe starts on a new OGG page. This improves seeking in MPlayer and enlarges the file only marginally (17KiB for a 700MiB file). - Fixed DOS newlines in various files (prevented sucessful compilation on some systems). * released v0.921 - Changed the subtitle packet ordering to emulate the (buggy) OggDS behaviour. * released v0.92 - Fixes for ogmsplit - split after a certain amount of written data or after an elapsed time. 2002-09-12 Moritz Bunkus - Added support for MP3 audio. Can be read from a separate file, from an AVI or from an OGM. - Added a new tool, ogmsplit, that will split before a keyframe around a given size. - Fixed page ordering: pages are now output depending on their start time (which is the stream's previous granulepos), not on their current granulepos. - Fixed ogminfo to check the page's start time (see point above) for 'sync_ok'/'OUT_OF_SYNC'. - Fixed some bugs with ogminfo's output. - Removed ogmsplit.pl because ogmsplit does a much better and much faster job. - Added Debian patch from Marc Leeman to my 'official' sources. 2002-08-26 Moritz Bunkus * released v0.901 - Fixed a small bug: if a WAV file should be read it was parsed as a SRT file as well. 2002-08-24 Moritz Bunkus * released v0.9 - ogminfo does now output the file position in bytes for each OGG page if the verbosity level is 3 or higher. - Added a small Perl script called ogmsplit.pl that attempts to split an OGM file after a specified size in megabytes. 2002-08-23 Moritz Bunkus - Fixed some bugs with subtitle support. Should work now. - Changed the granulepos calculation for some stream types. It should now more closely resemble the way OggDS calculates it. - Changed ogminfo's output format and included some more information. 2002-08-17 Moritz Bunkus - Mandatory comment packets are now created, and the user can specify his/her own comments using '-c "TAG1=Value#TAG2=Another Value' syntax. - Included avilib in the ogmmerge sources (thanks to Robert Wal for the patch). 2002-08-15 Moritz Bunkus - First support for SRT subtitles in ogmmerge. 2002-08-14 Moritz Bunkus - ogmdemux now extracts streams to useful formats: video to AVI, text streams to text files (SRT format), Vorbis audio to OGGs, PCM audio to WAV files. All other audio formats are still just copied 1:1. - ogminfo can correctly handle text streams (subtitles). 2002-08-02 Moritz Bunkus * released v0.8 - added audio synchronization for linear drifts - added the option to process only a specific range 2002-07-30 Moritz Bunkus * released v0.7 - added audio synchronization by adding silence/removing packets at the beginning of an audio stream 2002-07-28 Moritz Bunkus * released v0.6 - ogmmerge completely written in C++ - support for reading AVIs (including audio tracks) - support for reading OGG files (Vorbis-only and those produced by ogmmerge itself) - fixed some packet ordering issues 2002-07-24 Moritz Bunkus * released v0.501 - fixed a bug in vorbis.c with not initialized structures 2002-07-24 Moritz Bunkus * released v0.5 ogmtools-1.5/mp3_common.c0000644000076400234220000000476007655160106015102 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes mp3_common.cpp common routines for MP3 handling Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include "mp3_common.h" #include "common.h" int mp3_tabsel[2][16] = {{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320}, {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}}; long mp3_freqs[9] = {44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000}; int find_mp3_header(char *buf, int size, unsigned long *_header) { int i; unsigned long header; int pos; if (size < 4) return -1; for (pos = 0; pos <= (size - 4); pos++) { for (i = 0, header = 0; i < 4; i++) { header <<= 8; header |= (unsigned char)buf[i + pos]; } if ((header == FOURCC('R', 'I', 'F', 'F')) || ((header & 0xffffff00) == FOURCC('I', 'D', '3', ' '))) continue; if ((header & 0xffe00000) != 0xffe00000) continue; if (!((header >> 17) & 3)) continue; if (((header >> 12) & 0xf) == 0xf) continue; if (!((header >> 12) & 0xf)) continue; if (((header >> 10) & 0x3) == 0x3) continue; if ((((header >> 19) & 1) == 1) && (((header >> 17) & 3) == 3) && (((header >> 16) & 1) == 1)) continue; if ((header & 0xffff0000) == 0xfffe0000) continue; *_header = header; return pos; } return -1; } void decode_mp3_header(unsigned long header, mp3_header_t *h) { if (header & (1 << 20)) { h->lsf = (header & (1 << 19)) ? 0 : 1; h->mpeg25 = 0; } else { h->lsf = 1; h->mpeg25 = 1; } h->mode = (header >> 6) & 3; h->error_protection = ((header >> 16) & 1) ^ 1; h->stereo = (h->mode == 3 ? 1 : 2); if (h->lsf) h->ssize = (h->stereo == 1 ? 9 : 17); else h->ssize = (h->stereo == 1 ? 17: 32); if (h->error_protection) h->ssize += 2; h->bitrate_index = (header >> 12) & 15; if (h->mpeg25) h->sampling_frequency = 6 + ((header >> 10) & 3); else h->sampling_frequency = ((header >> 10) & 3) + (h->lsf * 3); h->padding = (header >> 9) & 1; h->framesize = (long)mp3_tabsel[h->lsf][h->bitrate_index] * 144000; h->framesize /= (mp3_freqs[h->sampling_frequency] << h->lsf); h->framesize = h->framesize + h->padding - 4; } ogmtools-1.5/ogmmerge.h0000644000076400234220000000641707757237160014653 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes ogmmerge.h general class and type definitions Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __ogmmerge_H__ #define __ogmmerge_H__ #include #include #include #include "common.h" #include "ogmstreams.h" #define DISPLAYPRIORITY_HIGH 10 #define DISPLAYPRIORITY_MEDIUM 5 #define DISPLAYPRIORITY_LOW 1 typedef struct { int displacement; double linear; } audio_sync_t; typedef struct { double start; double end; } range_t; typedef double stamp_t; #define MAX_TIMESTAMP ((double)3.40282347e+38F) typedef struct { ogg_page *og; stamp_t timestamp; int header_page; int index_serial; } ogmmerge_page_t; typedef class generic_reader_c { protected: vorbis_comment *chapter_info; public: generic_reader_c(); virtual ~generic_reader_c(); virtual int read() = 0; virtual int serial_in_use(int serial) = 0; virtual ogmmerge_page_t *get_page() = 0; virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER) = 0; virtual void reset() = 0; virtual int display_priority() = 0; virtual void display_progress() = 0; virtual void set_chapter_info(vorbis_comment *info); } generic_reader_c; typedef class generic_packetizer_c { protected: int serialno; vorbis_comment *comments; public: generic_packetizer_c(); virtual ~generic_packetizer_c() {}; virtual int page_available() = 0; virtual ogmmerge_page_t *get_page() = 0; virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER) = 0; virtual stamp_t make_timestamp(ogg_int64_t granulepos) = 0; virtual int serial_in_use(int serial); virtual int flush_pages(int header_page = 0) = 0; virtual int queue_pages(int header_page = 0) = 0; virtual stamp_t get_smallest_timestamp() = 0; virtual void produce_eos_packet() = 0; virtual void produce_header_packets() = 0; virtual void reset() = 0; virtual void set_comments(vorbis_comment *ncomments); } generic_packetizer_c; class error_c { private: char *error; public: error_c(char *nerror) { error = nerror; }; char *get_error() { return error; }; }; #ifndef OGMSPLIT extern int force_flushing; extern int omit_empty_packets; extern int old_headers; extern float video_fps; // needed for MicroDVD fps-to-time conversion int create_unique_serial(); extern void add_index(int serial); #endif int chapter_information_probe(FILE *file, off_t size); vorbis_comment *chapter_information_read(char *name); vorbis_comment *chapter_information_adjust(vorbis_comment *vc, double start, double end); #endif /* __ogmmerge_H__ */ ogmtools-1.5/r_ogm.h0000644000076400234220000000603010012136675014126 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_ogm.h class definitions for the OGG demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_OGM_H__ #define __R_OGM_H__ #include #include #include "ogmmerge.h" #include "queue.h" #define OGM_STREAM_TYPE_UNKNOWN 0 #define OGM_STREAM_TYPE_VORBIS 1 #define OGM_STREAM_TYPE_VIDEO 2 #define OGM_STREAM_TYPE_PCM 3 #define OGM_STREAM_TYPE_MP3 4 #define OGM_STREAM_TYPE_AC3 5 #define OGM_STREAM_TYPE_TEXT 6 typedef struct ogm_demuxer_t { ogg_stream_state os; generic_packetizer_c *packetizer; int sid; int stype; int eos; int serial; int units_processed; ogm_demuxer_t *next; } ogm_demuxer_t; class ogm_reader_c: public generic_reader_c { private: ogg_sync_state oy; unsigned char *astreams, *vstreams, *tstreams; FILE *file; char *filename; int act_wchar; ogm_demuxer_t *sdemuxers; int nastreams, nvstreams, ntstreams, numstreams; audio_sync_t async; range_t range; char **comments; char *fourcc; int o_eos; public: ogm_reader_c(char *fname, unsigned char *astreams, unsigned char *vstreams, unsigned char *tstreams, audio_sync_t *nasync, range_t *nrange, char **ncomments, char *nfourcc) throw (error_c); virtual ~ogm_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); virtual void overwrite_eos(int no_eos); virtual generic_packetizer_c *set_packetizer(generic_packetizer_c *np); static int probe_file(FILE *file, off_t size); private: virtual ogm_demuxer_t *find_demuxer(int serialno); virtual int demuxing_requested(unsigned char *, int); virtual void flush_packetizers(); virtual int read_page(ogg_page *); virtual void add_new_demuxer(ogm_demuxer_t *); virtual int pages_available(); virtual void handle_new_stream(ogg_page *); virtual void process_page(ogg_page *); virtual void read_headers(); }; #endif /* __R_OGM_H__*/ ogmtools-1.5/generic.cpp0000644000076400234220000001637507746030676015025 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes generic.cpp generic base classes, chapter file support Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include "common.h" #include "ogmmerge.h" #include "vorbis_header_utils.h" generic_packetizer_c::generic_packetizer_c() { comments = NULL; } int generic_packetizer_c::serial_in_use(int serial) { return (serial == serialno); } void generic_packetizer_c::set_comments(vorbis_comment *ncomments) { if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } if (ncomments == NULL) { comments = NULL; return; } comments = (vorbis_comment *)malloc(sizeof(vorbis_comment)); if (comments == NULL) die("malloc"); memcpy(comments, ncomments, sizeof(vorbis_comment)); } generic_reader_c::generic_reader_c() { chapter_info = NULL; } generic_reader_c::~generic_reader_c() { if (chapter_info != NULL) { vorbis_comment_clear(chapter_info); free(chapter_info); } } void generic_reader_c::set_chapter_info(vorbis_comment *info) { if (chapter_info != NULL) { vorbis_comment_clear(chapter_info); free(chapter_info); } chapter_info = vorbis_comment_dup(info); } #define isequal(s) (*(s) == '=') #define iscolon(s) (*(s) == ':') #define isfullstop(s) (*(s) == '.') #define istwodigits(s) (isdigit(*(s)) && isdigit(*(s + 1))) #define isthreedigits(s) (isdigit(*(s)) && isdigit(*(s + 1)) && \ isdigit(*(s + 2))) #define isarrow(s) (!strncmp((s), " --> ", 5)) #define istimestamp(s) (istwodigits(s) && iscolon(s + 2) && \ istwodigits(s + 3) && iscolon(s + 5) && \ istwodigits(s + 6) && isfullstop(s + 8) && \ isthreedigits(s + 9)) #define ischapter(s) ((strlen(s) == 22) && \ !strncmp(s, "CHAPTER", 7) && \ istwodigits(s + 7) && isequal(s + 9) && \ istimestamp(s + 10)) #define ischaptername(s) ((strlen(s) > 14) && \ !strncmp(s, "CHAPTER", 7) && \ istwodigits(s + 7) && \ !strncmp(s + 9, "NAME", 4) && isequal(s + 13)) int chapter_information_probe(FILE *file, off_t size) { char buf[201]; int len; if (size < 37) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fgets(buf, 200, file) == NULL) return 0; len = strlen(buf); if (len == 0) return 0; if (buf[len - 1] != '\n') return 0; if (strncmp(buf, "CHAPTER", 7)) return 0; if (strncmp(&buf[9], "=", 1)) return 0; if (!istimestamp(&buf[10])) return 0; if (fgets(buf, 200, file) == NULL) return 0; len = strlen(buf); if (len == 0) return 0; if (buf[len - 1] != '\n') return 0; if (strncmp(buf, "CHAPTER", 7)) return 0; if (strncmp(&buf[9], "NAME=", 5)) return 0; return 1; } vorbis_comment *chapter_information_read(char *name) { vorbis_comment *vc; char buf[201]; char *s; int len; FILE *file; if ((file = fopen(name, "r")) == NULL) return NULL; if (fseeko(file, 0, SEEK_SET) != 0) return NULL; if (verbose) fprintf(stdout, "Using chapter information reader for %s.\n", name); vc = (vorbis_comment *)malloc(sizeof(vorbis_comment)); if (vc == NULL) die("malloc"); vc->vendor = strdup(VERSIONINFO); vc->user_comments = (char **)mmalloc(4); vc->comment_lengths = (int *)mmalloc(4); vc->comments = 0; while (!feof(file)) { if (fgets(buf, 200, file) != NULL) { len = strlen(buf); if (len > 0) { s = &buf[len - 1]; while ((s != buf) && ((*s == '\n') || (*s == '\r'))) { *s = 0; s--; } len = strlen(buf); if (len > 0) vorbis_comment_add(vc, buf); } } } return vc; } vorbis_comment *chapter_information_adjust(vorbis_comment *vc, double start, double end) { vorbis_comment *nvc; int i, chapter_sub, chapter, hour, min, sec, msec; char *copy; char *last; char copy_chapters[100], new_chapter[24]; double cstart; if (vc == NULL) return NULL; memset(copy_chapters, 0, 100); nvc = (vorbis_comment *)malloc(sizeof(vorbis_comment)); if (nvc == NULL) die("malloc"); nvc->vendor = strdup(VERSIONINFO); nvc->user_comments = (char **)mmalloc(4); nvc->comment_lengths = (int *)mmalloc(4); nvc->comments = 0; chapter_sub = -1; last = NULL; for (i = 0; i < vc->comments; i++) { if (ischapter(vc->user_comments[i])) { copy = strdup(vc->user_comments[i]); if (copy == NULL) die("malloc"); /* * CHAPTER01=01:23:45.678 * 0123456789012345678901 * 1 2 */ copy[9] = 0; // = copy[12] = 0; // : copy[15] = 0; // : copy[18] = 0; // . chapter = strtol(©[7], NULL, 10); hour= strtol(©[10], NULL, 10); min = strtol(©[13], NULL, 10); sec = strtol(©[16], NULL, 10); msec = strtol(©[19], NULL, 10); cstart = msec + (1000.0 * sec) + (60000.0 * min) + (3600000.0 * hour); if ((cstart >= start) && (cstart < end)) { copy_chapters[chapter] = 1; if (chapter_sub == -1) { chapter_sub = chapter - 1; if (last && (cstart > start)) { int last_length = strlen(last); sprintf(new_chapter, "CHAPTER01=00:00:00.000"); vorbis_comment_add(nvc, new_chapter); last = (char *)realloc(last, last_length + 12 + 1); sprintf(&last[7], "01"); last[9] = 'N'; sprintf(&last[last_length], " (continued)"); last[last_length+12] = 0; vorbis_comment_add(nvc, last); free(last); chapter_sub--; } } chapter -= chapter_sub; sprintf(new_chapter, "CHAPTER%02d=%02d:%02d:%02d.%03d", chapter, (((int)(cstart - start)) / 1000 / 60 / 60), (((int)(cstart - start)) / 1000 / 60) % 60, (((int)(cstart - start)) / 1000) % 60, ((int)(cstart - start)) % 1000); vorbis_comment_add(nvc, new_chapter); } free(copy); } else if (ischaptername(vc->user_comments[i])) { memcpy(new_chapter, &vc->user_comments[i][7], 2); new_chapter[2] = 0; chapter = strtol(new_chapter, NULL, 10); if (copy_chapters[chapter]) { copy = strdup(vc->user_comments[i]); if (copy == NULL) die("malloc"); sprintf(©[7], "%02d", chapter - chapter_sub); copy[9] = 'N'; vorbis_comment_add(nvc, copy); free(copy); } else if (chapter_sub == -1) { if (last != NULL) free(last); last = strdup(vc->user_comments[i]); if (last == NULL) die("malloc"); } } else vorbis_comment_add(nvc, vc->user_comments[i]); } return nvc; } ogmtools-1.5/mp3_common.h0000644000076400234220000000162207540164240015075 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes mp3_common.h common routines for MP3 handling Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __MP3_COMMON_H #define __MP3_COMMON_H #ifdef __cplusplus extern "C" { #endif extern int mp3_tabsel[2][16]; extern long mp3_freqs[9]; typedef struct { int lsf; int mpeg25; int mode; int error_protection; int stereo; int ssize; int bitrate_index; int sampling_frequency; int padding; int framesize; } mp3_header_t; int find_mp3_header(char *buf, int size, unsigned long *_header); void decode_mp3_header(unsigned long header, mp3_header_t *h); #ifdef __cplusplus } #endif #endif ogmtools-1.5/p_mp3.cpp0000644000076400234220000002037307662352165014415 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_mp3.cpp MP3 output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "mp3_common.h" #include "p_mp3.h" #include "vorbis_header_utils.h" mp3_packetizer_c::mp3_packetizer_c(unsigned long nsamples_per_sec, int nchannels, int nmp3rate, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) : q_c() { serialno = create_unique_serial(); ogg_stream_init(&os, serialno); packetno = 0; samples_per_sec = nsamples_per_sec; channels = nchannels; mp3rate = nmp3rate; bytes_output = 0; memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); comments = generate_vorbis_comment(ncomments); old_granulepos = 0; packet_buffer = NULL; buffer_size = 0; eos = 0; } mp3_packetizer_c::~mp3_packetizer_c() { ogg_stream_clear(&os); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } if (packet_buffer != NULL) free(packet_buffer); } void mp3_packetizer_c::add_to_buffer(char *buf, int size) { char *new_buffer; new_buffer = (char *)realloc(packet_buffer, buffer_size + size); if (new_buffer == NULL) die("realloc"); memcpy(new_buffer + buffer_size, buf, size); packet_buffer = new_buffer; buffer_size += size; } int mp3_packetizer_c::mp3_packet_available() { unsigned long header; int pos; mp3_header_t mp3header; if (packet_buffer == NULL) return 0; pos = find_mp3_header(packet_buffer, buffer_size, &header); if (pos < 0) return 0; decode_mp3_header(header, &mp3header); if ((pos + mp3header.framesize + 4) > buffer_size) return 0; return 1; } void mp3_packetizer_c::remove_mp3_packet(int pos, int framesize) { int new_size; char *temp_buf; new_size = buffer_size - (pos + framesize + 4) + 1; temp_buf = (char *)malloc(new_size); if (temp_buf == NULL) die("malloc"); if (new_size != 0) memcpy(temp_buf, &packet_buffer[pos + framesize + 4 - 1], new_size); free(packet_buffer); packet_buffer = temp_buf; buffer_size = new_size; } char *mp3_packetizer_c::get_mp3_packet(unsigned long *header, mp3_header_t *mp3header) { int pos; char *buf; double pims; if (packet_buffer == NULL) return 0; pos = find_mp3_header(packet_buffer, buffer_size, header); if (pos < 0) return 0; decode_mp3_header(*header, mp3header); if ((pos + mp3header->framesize + 4) > buffer_size) return 0; pims = 1000.0 * 1152.0 / mp3_freqs[mp3header->sampling_frequency]; if (async.displacement < 0) { /* * MP3 audio synchronization. displacement < 0 means skipping an * appropriate number of packets at the beginning. */ async.displacement += (int)pims; if (async.displacement > -(pims / 2)) async.displacement = 0; remove_mp3_packet(pos, mp3header->framesize); return 0; } if ((verbose > 1) && (pos > 1)) fprintf(stdout, "mp3_packetizer: skipping %d bytes (no valid MP3 header " "found).\n", pos); buf = (char *)malloc(mp3header->framesize + 4); if (buf == NULL) die("malloc"); memcpy(buf, packet_buffer + pos, mp3header->framesize + 4); if (async.displacement > 0) { /* * MP3 audio synchronization. displacement > 0 is solved by creating * silent MP3 packets and repeating it over and over again (well only as * often as necessary of course. Wouldn't want to spoil your movie by * providing a silent MP3 stream ;)). */ async.displacement -= (int)pims; if (async.displacement < (pims / 2)) async.displacement = 0; memset(buf + 4, 0, mp3header->framesize); return buf; } remove_mp3_packet(pos, mp3header->framesize); return buf; } void mp3_packetizer_c::produce_header_packets() { stream_header sh; unsigned char *tempbuf; ogg_packet op; int clen, res; memset(&sh, 0, sizeof(sh)); strcpy(sh.streamtype, "audio"); memcpy(sh.subtype, "0055", 4); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, 10000000); put_uint64(&sh.samples_per_unit, samples_per_sec); put_uint32(&sh.default_len, 1); put_uint32(&sh.buffersize, samples_per_sec); put_uint16(&sh.bits_per_sample, 0); put_uint16(&sh.sh.audio.channels, channels); put_uint16(&sh.sh.audio.blockalign, 1152); put_uint32(&sh.sh.audio.avgbytespersec, mp3rate * 1000 / 8); tempbuf = (unsigned char *)malloc(sizeof(sh) + 1); if (tempbuf == NULL) die("malloc"); *tempbuf = PACKET_TYPE_HEADER; memcpy((char *)&tempbuf[1], &sh, sizeof(sh)); op.packet = tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; /* submit it */ ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); free(tempbuf); /* Create the comments packet */ clen = -1 * comments_to_buffer(comments, NULL, 0); tempbuf = (unsigned char *)malloc(clen); if (tempbuf == NULL) die("malloc"); op.packet = tempbuf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; if ((res = comments_to_buffer(comments, (char *)op.packet, clen)) < 0) { fprintf(stderr, "FATAL: p_mp3: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; free(tempbuf); } int mp3_packetizer_c::process(char *buf, int size, int last_frame) { ogg_packet op; int i, tmpsize; unsigned char *bptr, *tempbuf; char *packet; unsigned long header; mp3_header_t mp3header; if (packetno == 0) produce_header_packets(); add_to_buffer(buf, size); while ((packet = get_mp3_packet(&header, &mp3header)) != NULL) { if ((4 - ((header >> 17) & 3)) != 3) { fprintf(stdout, "Warning: p_mp3: packet is not a valid MP3 packet (" \ "packet number %lld)\n", packetno - 2); return EMOREDATA; } tempbuf = (unsigned char *)malloc(mp3header.framesize + 5 + sizeof(u_int16_t)); if (tempbuf == NULL) die("malloc"); tempbuf[0] = (((sizeof(u_int16_t) & 3) << 6) + ((sizeof(u_int16_t) & 4) >> 1)) | PACKET_IS_SYNCPOINT; op.bytes = mp3header.framesize + 5 + sizeof(u_int16_t); bptr = (unsigned char *)&tempbuf[1]; for (i = 0, tmpsize = 1152; i < sizeof(u_int16_t); i++) { *(bptr + i) = (unsigned char)(tmpsize & 0xFF); tmpsize = tmpsize >> 8; } memcpy(&tempbuf[1 + sizeof(u_int16_t)], packet, mp3header.framesize + 4); op.packet = (unsigned char *)&tempbuf[0]; op.b_o_s = 0; if (last_frame && !mp3_packet_available()) { op.e_o_s = 1; eos = 1; } else op.e_o_s = 0; op.granulepos = (u_int64_t)((packetno - 2) * 1152 * async.linear); op.packetno = packetno++; ogg_stream_packetin(&os, &op); bytes_output += mp3header.framesize + 4; free(tempbuf); free(packet); } if (last_frame) { flush_pages(); return 0; } else { queue_pages(); return EMOREDATA; } } void mp3_packetizer_c::reset() { } void mp3_packetizer_c::produce_eos_packet() { ogg_packet op; if (eos) return; op.packet = (unsigned char *)""; op.bytes = 1; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = (u_int64_t)((packetno - 2) * 1152); op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); eos = 1; } stamp_t mp3_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef INCORRECT_INTERLEAVING stamp = (stamp_t)((double)old_granulepos * (double)1000000.0 / (double)samples_per_sec); old_granulepos = granulepos; #else stamp = (stamp_t)((double)granulepos * 1000000.0 / (double)samples_per_sec); #endif return stamp; } ogmtools-1.5/dvdxchap.10000644000076400234220000000267710143371176014554 0ustar mosuvj00000000000000.TH DVDXCHAP "1" "November 2004" "dvdxchap v1.5" "User Commands" .SH NAME dvdxchap \- Extract chapter information from DVDs .SH SYNOPSIS .B dvdxchap [\fIoptions\fR] \fIDVD-SOURCE\fR .SH DESCRIPTION .LP This program extracts chapter information from a DVD and displays it in a form usable by \fBogmmerge(1)\fP. .TP \fB\-t\fR, \fB\-\-title\fR \fInum\fR Use title '\fInum\fR'. Default is 1. .TP \fB\-c\fR, \fB\-\-chapter\fR \fIstart\fR[-\fIend\fR] Only output the given range of chapters and adjust all timecodes so that they start at 0. The default is to output all chapters. .TP \fB\-v\fR Increase verbosity .TP \fB\-V\fR Show version information .TP \fB\-h\fR Show help .SH EXAMPLES .LP The output generated by \fBdvdxchap\fP will have the form .LP CHAPTER01=00:01:35.240 .br CHAPTER01NAME=Chapter 01 .br CHAPTER02=00:03:40:300 .br CHAPTER02NAME=Chapter 02 .br etc. .LP You should pipe its output to a file, edit the chapter names and use the resulting file as an input for \fBogmmerge(1)\fP. .SH AUTHOR .I dvdxchap was written by Moritz Bunkus . Some ideas were taken from Chapter-X-Tractor .UR () .UE written by Christophe Paris. .SH SEE ALSO .BR ogmmerge (1), .BR ogmsplit (1), .BR ogminfo (1), .BR ogmdemux (1) .SH WWW The newest version can always be found at .UR http://www.bunkus.org/videotools/ogmtools/ .UE ogmtools-1.5/r_mp3.cpp0000644000076400234220000001021310072544130014367 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_mp3.cpp MP3 demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_mp3.h" #include "mp3_common.h" #define PROBESIZE 8192 int mp3_reader_c::probe_file(FILE *file, off_t size) { char buf[PROBESIZE]; int pos; unsigned long header; mp3_header_t mp3header; if (size < PROBESIZE) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fread(buf, 1, PROBESIZE, file) != PROBESIZE) { fseeko(file, 0, SEEK_SET); return 0; } fseeko(file, 0, SEEK_SET); pos = find_mp3_header(buf, PROBESIZE, &header); if (pos < 0) return 0; decode_mp3_header(header, &mp3header); if ((4 - ((header >> 17) & 3)) != 3) return 0; pos = find_mp3_header(&buf[pos + mp3header.framesize + 4], PROBESIZE - pos - 4 - mp3header.framesize, &header); if (pos != 0) return 0; return 1; } mp3_reader_c::mp3_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) { int pos; unsigned long header; mp3_header_t mp3header; if ((file = fopen(fname, "r")) == NULL) throw error_c("mp3_reader: Could not open source file."); if (fseeko(file, 0, SEEK_END) != 0) throw error_c("mp3_reader: Could not seek to end of file."); size = ftello(file); if (fseeko(file, 0, SEEK_SET) != 0) throw error_c("mp3_reader: Could not seek to beginning of file."); chunk = (unsigned char *)malloc(4096); if (chunk == NULL) die("malloc"); if (fread(chunk, 1, 4096, file) != 4096) throw error_c("mp3_reader: Could not read 4096 bytes."); if (fseeko(file, 0, SEEK_SET) != 0) throw error_c("mp3_reader: Could not seek to beginning of file."); pos = find_mp3_header((char *)chunk, 4096, &header); if (pos < 0) throw error_c("mp3_reader: No valid MP3 packet found in the first " \ "4096 bytes.\n"); decode_mp3_header(header, &mp3header); bytes_processed = 0; mp3packetizer = new mp3_packetizer_c(mp3_freqs[mp3header.sampling_frequency], mp3header.stereo, mp3_tabsel[mp3header.lsf] [mp3header.bitrate_index], nasync, nrange, ncomments); if (verbose) fprintf(stderr, "Using MP3 demultiplexer for %s.\n+-> Using " \ "MP3 output module for audio stream.\n", fname); } mp3_reader_c::~mp3_reader_c() { if (file != NULL) fclose(file); if (chunk != NULL) free(chunk); if (mp3packetizer != NULL) delete mp3packetizer; } int mp3_reader_c::read() { int nread, last_frame; do { if (mp3packetizer->page_available()) return EMOREDATA; nread = fread(chunk, 1, 4096, file); if (nread <= 0) { mp3packetizer->produce_eos_packet(); return 0; } last_frame = (nread == 4096 ? 0 : 1); mp3packetizer->process((char *)chunk, nread, last_frame); bytes_processed += nread; if (last_frame) return 0; } while (1); } int mp3_reader_c::serial_in_use(int serial) { return mp3packetizer->serial_in_use(serial); } ogmmerge_page_t *mp3_reader_c::get_header_page(int header_type) { return mp3packetizer->get_header_page(header_type); } ogmmerge_page_t *mp3_reader_c::get_page() { return mp3packetizer->get_page(); } void mp3_reader_c::reset() { if (mp3packetizer != NULL) mp3packetizer->reset(); } int mp3_reader_c::display_priority() { return DISPLAYPRIORITY_HIGH - 1; } void mp3_reader_c::display_progress() { fprintf(stdout, "progress: %lld/%lld bytes (%d%%)\r", bytes_processed, size, (int)(bytes_processed * 100L / size)); fflush(stdout); } ogmtools-1.5/r_vobsub.cpp0000644000076400234220000002753610037021763015213 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_vobsub.cpp VobSub text subtitle reader module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifdef ENABLE_VOBSUB #include #include #include #include #include #include #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_vobsub.h" #include "subtitles.h" #define istimestampstr(s) (!strncmp(s, "timestamp: ", 11)) #define iscommafileposstr(s) (!strncmp(s, ", filepos: ", 11)) #define iscolon(s) (*(s) == ':') #define istwodigits(s) (isdigit(*(s)) && isdigit(*(s + 1))) #define isthreedigits(s) (isdigit(*(s)) && isdigit(*(s + 1)) && \ isdigit(*(s + 2))) #define istwodigitscolon(s) (istwodigits(s) && iscolon(s + 2)) #define istimestamp(s) (istwodigitscolon(s) && \ istwodigitscolon(s + 3) && \ istwodigitscolon(s + 6) && \ isthreedigits(s + 9)) #define ishexdigit(s) (isdigit(s) || \ (strchr("abcdefABCDEF", s) != NULL)) #define isfilepos(s) (ishexdigit(*(s)) && ishexdigit(*(s + 1)) && \ ishexdigit(*(s + 2)) && \ ishexdigit(*(s + 3)) && \ ishexdigit(*(s + 4)) && \ ishexdigit(*(s + 5)) && \ ishexdigit(*(s + 6)) && \ ishexdigit(*(s + 7)) && \ ishexdigit(*(s + 8))) #define isvobsubline(s) (istimestampstr(s) && istimestamp(s + 11) && \ iscommafileposstr(s + 23) && \ isfilepos(s + 34)) int vobsub_reader_c::probe_file(FILE *file, off_t size) { char chunk[2048]; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fgets(chunk, 2047, file) == NULL) return 0; if (strncmp(chunk, "# VobSub index file, v7", strlen("# VobSub index file, v7"))) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; return 1; } vobsub_reader_c::vobsub_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) { char *name; if ((file = fopen(fname, "r")) == NULL) throw error_c("vobsub_reader: Could not open source file."); if (!vobsub_reader_c::probe_file(file, 0)) throw error_c("vobsub_reader: Source is not a valid VobSub index file."); name = strdup(fname); if (name == NULL) die("strdup"); if ((strlen(name) > 4) && (name[strlen(name) - 4] == '.')) name[strlen(name) - 4] = 0; else { name = (char *)realloc(name, strlen(name) + 5); if (name == NULL) die("realloc"); } strcat(name, ".sub"); if ((subfile = fopen(name, "r")) == NULL) throw error_c("vobsub_reader: Could not open the sub file."); vobsub_packetizer = NULL; all_packetizers = NULL; num_packetizers = 0; if (verbose) fprintf(stderr, "Using VobSub subtitle reader for %s/%s.\n+-> Using " \ "VobSub subtitle output module for subtitles.\n", fname, name); free(name); memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); if (ncomments == NULL) comments = ncomments; else comments = dup_comments(ncomments); } vobsub_reader_c::~vobsub_reader_c() { int i; for (i = 0; i < num_packetizers; i++) if (all_packetizers[i] != NULL) delete all_packetizers[i]; if (comments != NULL) free_comments(comments); } void vobsub_reader_c::add_vobsub_packetizer(int width, int height, char *palette, int langidx, char *id, int index) { all_packetizers = (vobsub_packetizer_c **)realloc(all_packetizers, (num_packetizers + 1) * sizeof(void *)); if (all_packetizers == NULL) die("realloc"); try { vobsub_packetizer = new vobsub_packetizer_c(width, height, palette, langidx, id, index, &async, &range, comments); } catch (error_c error) { fprintf(stderr, "vobsub_reader: Could not create a new vobsub_packetizer: " "%s\n", error.get_error()); exit(1); } all_packetizers[num_packetizers] = vobsub_packetizer; num_packetizers++; } int vobsub_reader_c::read() { ogg_int64_t start, filepos, last_start; off_t last_filepos; char *s, *s2; int width = -1, height = -1; char *palette = NULL; int langidx = -1; char *id = NULL; int index = -1; int lineno; chunk[2047] = 0; lineno = 0; last_start = -1; last_filepos = -1; while (1) { if (fgets(chunk, 2047, file) == NULL) break; lineno++; if ((*chunk == 0) || (strchr("#\n\r", *chunk) != NULL)) continue; if (!strncmp(chunk, "size: ", 6)) { if (sscanf(&chunk[6], "%dx%d", &width, &height) != 2) { width = -1; height = -1; fprintf(stdout, "vobsub_reader: Warning: Incorrect \"size:\" entry " "on line %d. Ignored.\n", lineno); } } else if (!strncmp(chunk, "palette: ", 9)) { if (strlen(chunk) < 10) fprintf(stdout, "vobsub_reader: Warning: Incorrect \"palette:\" entry " "on line %d. Ignored.\n", lineno); else { palette = strdup(&chunk[9]); if (palette == NULL) die("strdup"); } } else if (!strncmp(chunk, "langidx: ", 9)) { langidx = strtol(&chunk[9], NULL, 10); if ((langidx < 0) || (errno != 0)) { fprintf(stdout, "vobsub_reader: Warning: Incorrect \"langidx:\" entry " "on line %d. Ignored.\n", lineno); langidx = -1; } } else if (!strncmp(chunk, "id:", 3)) { s = &chunk[3]; while (isspace(*s)) s++; s2 = strchr(s, ','); if (s2 == NULL) { fprintf(stdout, "vobsub_reader: Warning: Incorrect \"id:\" entry " "on line %d. Ignored.\n", lineno); continue; } *s2 = 0; id = strdup(s); if (id == NULL) die("strdup"); s = s2 + 1; while (isspace(*s)) s++; if (strncmp(s, "index:", 6)) { fprintf(stdout, "vobsub_reader: Warning: Incorrect \"id:\" entry " "on line %d. Ignored.\n", lineno); continue; } s += 6; while (isspace(*s)) s++; index = strtol(s, NULL, 10); if ((index < 0) || (errno != 0)) { fprintf(stdout, "vobsub_reader: Warning: Incorrect \"id:\" entry " "on line %d. Ignored.\n", lineno); continue; } } else if (!isvobsubline(chunk)) fprintf(stdout, "vobsub_reader: Warning: Unknown line format on line " "%d. Ignored.\n", lineno); else if (vobsub_packetizer == NULL) { if ((width == -1) || (height == -1)) { fprintf(stdout, "vobsub_reader: No \"size:\" entry found. " "File seems to be damaged. Aborting.\n"); exit(1); } if (palette == NULL) { fprintf(stdout, "vobsub_reader: No \"palette:\" entry found. " "File seems to be damaged. Aborting.\n"); exit(1); } if (langidx == -1) { fprintf(stdout, "vobsub_reader: No \"langidx:\" entry found. " "File seems to be damaged. Aborting.\n"); exit(1); } if ((id == NULL) || (index == -1)) { fprintf(stdout, "vobsub_reader: No \"id:\" entry found. " "File seems to be damaged. Aborting.\n"); exit(1); } add_vobsub_packetizer(width, height, palette, langidx, id, index); width = -1; height = -1; if (palette != NULL) { free(palette); palette = NULL; } langidx = -1; if (id != NULL) { free(id); id = NULL; } index = -1; } else { // timestamp: 00:00:03:440, filepos: 000000000 // 0123456789012345678901234567890123456789012 // 1 2 3 4 chunk[13] = 0; chunk[16] = 0; chunk[19] = 0; chunk[23] = 0; start = atol(&chunk[11]) * 3600000 + atol(&chunk[14]) * 60000 + atol(&chunk[17]) * 1000 + atol(&chunk[20]); filepos = strtoll(&chunk[34], NULL, 16); if ((last_start != -1) && (last_filepos != -1)) { if (fseeko(subfile, last_filepos, SEEK_SET) != 0) fprintf(stderr, "Warning: vobsub_reader: Could not seek to position " "%lld. Ignoring this entry.\n", last_filepos); else if (last_filepos == filepos) fprintf(stderr, "Warning: vobsub_reader: This entry and the last " "entry start at the same position in the file. Ignored.\n"); else { s = (char *)malloc(filepos - last_filepos); if (s == NULL) die("malloc"); if (fread(s, 1, filepos - last_filepos, subfile) != (filepos - last_filepos)) fprintf(stderr, "Warning: vobsub_reader: Could not read entry " "from the sub file. Ignored.\n"); else vobsub_packetizer->process(last_start, start - last_start, s, filepos - last_filepos, 0); free(s); } } last_start = start; last_filepos = filepos; fprintf(stdout, "line %d, start %lld, filepos %lld\n", lineno, start, filepos); } } if ((last_start != -1) && (last_filepos != -1) && (vobsub_packetizer != NULL)) { if (fseeko(subfile, 0, SEEK_END) != 0) { fprintf(stderr, "Warning: vobsub_reader: Could not seek to end of " "the sub file. Ignoring last entry.\n"); vobsub_packetizer->produce_eos_packet(); return 0; } filepos = ftello(subfile); if (fseeko(subfile, last_filepos, SEEK_SET) != 0) fprintf(stderr, "Warning: vobsub_reader: Could not seek to position " "%lld. Ignoring this entry.\n", last_filepos); else if (last_filepos == filepos) fprintf(stderr, "Warning: vobsub_reader: This entry and the last " "entry start at the same position in the file. Ignored.\n"); else { s = (char *)malloc(filepos - last_filepos); if (s == NULL) die("malloc"); if (fread(s, 1, filepos - last_filepos, subfile) != (filepos - last_filepos)) fprintf(stderr, "Warning: vobsub_reader: Could not read entry " "from the sub file. Ignored.\n"); else vobsub_packetizer->process(last_start, start - last_start, s, filepos - last_filepos, 1); free(s); } } return 0; } int vobsub_reader_c::serial_in_use(int serial) { // return vobsubpacketizer->serial_in_use(serial); return 0; } ogmmerge_page_t *vobsub_reader_c::get_header_page(int header_type) { // return vobsubpacketizer->get_header_page(header_type); return NULL; } ogmmerge_page_t *vobsub_reader_c::get_page() { // return vobsubpacketizer->get_page(); return NULL; } int vobsub_reader_c::display_priority() { return DISPLAYPRIORITY_LOW; } void vobsub_reader_c::reset() { // if (vobsubpacketizer != NULL) // vobsubpacketizer->reset(); } static char wchar[] = "-\\|/-\\|/-"; void vobsub_reader_c::display_progress() { fprintf(stdout, "working... %c\r", wchar[act_wchar]); act_wchar++; if (act_wchar == strlen(wchar)) act_wchar = 0; fflush(stdout); } #endif // ENABLE_VOBSUB ogmtools-1.5/r_wav.h0000644000076400234220000000300407655160106014144 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_wav.h class definitions for the WAVE demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_WAV_H__ #define __R_WAV_H__ #include #include extern "C" { #include } #include "ogmmerge.h" #include "queue.h" #include "p_pcm.h" class wav_reader_c: public generic_reader_c { private: unsigned char *chunk; FILE *file; class pcm_packetizer_c *pcmpacketizer; int bps; struct wave_header wheader; u_int64_t bytes_processed; public: wav_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~wav_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); }; #endif /* __R_WAV_H__*/ ogmtools-1.5/p_vorbis.cpp0000644000076400234220000002615107746030030015205 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_vorbis.cpp Vorbis audio output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "r_ogm.h" #include "p_vorbis.h" #include "vorbis_header_utils.h" vorbis_packetizer_c::vorbis_packetizer_c(audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) : q_c() { packetno = 0; old_granulepos = 0; serialno = create_unique_serial(); ogg_stream_init(&os, serialno); memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); skip_packets = 0; last_granulepos = 0; last_granulepos_seen = 0; range_converted = 0; header_packet = NULL; comments = generate_vorbis_comment(ncomments); } vorbis_packetizer_c::~vorbis_packetizer_c() { ogg_stream_clear(&os); vorbis_comment_clear(&vc); vorbis_info_clear(&vi); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } if (header_packet != NULL) { if (header_packet->packet != NULL) free(header_packet->packet); free(header_packet); } } int vorbis_packetizer_c::encode_silence(int fd) { vorbis_dsp_state lvds; vorbis_block lvb; vorbis_info lvi; vorbis_comment lvc; ogg_stream_state loss; ogg_page log; ogg_packet lop; ogg_packet h_main, h_comments, h_codebook; int samples, i, j, k, eos; float **buffer; samples = vi.rate * async.displacement / 1000; vorbis_info_init(&lvi); if (vorbis_encode_setup_vbr(&lvi, vi.channels, vi.rate, 1)) return EOTHER; vorbis_encode_setup_init(&lvi); vorbis_analysis_init(&lvds, &lvi); vorbis_block_init(&lvds, &lvb); vorbis_comment_init(&lvc); lvc.vendor = strdup(VERSIONINFO); lvc.user_comments = (char **)mmalloc(4); lvc.comment_lengths = (int *)mmalloc(4); lvc.comments = 0; ogg_stream_init(&loss, serialno); vorbis_analysis_headerout(&lvds, &lvc, &h_main, &h_comments, &h_codebook); ogg_stream_packetin(&loss, &h_main); ogg_stream_packetin(&loss, &h_comments); ogg_stream_packetin(&loss, &h_codebook); while (ogg_stream_flush(&loss, &log)) { write(fd, log.header, log.header_len); write(fd, log.body, log.body_len); } eos = 0; for (i = 0; i <= 1; i++) { if (i == 0) { buffer = vorbis_analysis_buffer(&lvds, samples); for (j = 0; j < samples; j++) for (k = 0; k < vi.channels; k++) buffer[k][j] = 0.0f; vorbis_analysis_wrote(&lvds, samples); } else vorbis_analysis_wrote(&lvds, 0); while (vorbis_analysis_blockout(&lvds, &lvb) == 1) { vorbis_analysis(&lvb, NULL); vorbis_bitrate_addblock(&lvb); while (vorbis_bitrate_flushpacket(&lvds, &lop)) { ogg_stream_packetin(&loss, &lop); while (!eos) { if (!ogg_stream_pageout(&loss, &log)) break; write(fd, log.header, log.header_len); write(fd, log.body, log.body_len); if (ogg_page_eos(&log)) eos = 1; } } } } ogg_stream_clear(&loss); vorbis_block_clear(&lvb); vorbis_dsp_clear(&lvds); vorbis_info_clear(&lvi); vorbis_comment_clear(&lvc); return 0; } void vorbis_packetizer_c::setup_displacement() { char tmpname[30]; int fd, old_verbose, status; ogm_reader_c *ogm_reader; audio_sync_t nosync; range_t norange; generic_packetizer_c *old_packetizer; ogmmerge_page_t *mpage; if (async.displacement <= 0) return; strcpy(tmpname, "/tmp/ogmmerge-XXXXXX"); if ((fd = mkstemp(tmpname)) == -1) { fprintf(stderr, "FATAL: vorbis_packetizer: mkstemp() failed.\n"); exit(1); } if (encode_silence(fd) < 0) { fprintf(stderr, "FATAL: Could not encode silence.\n"); exit(1); } close(fd); old_verbose = verbose; memset(&norange, 0, sizeof(range_t)); verbose = 0; nosync.displacement = 0; nosync.linear = 1.0; try { ogm_reader = new ogm_reader_c(tmpname, NULL, NULL, NULL, &nosync, &norange, NULL, NULL); } catch (error_c error) { fprintf(stderr, "FATAL: vorbis_packetizer: Could not create an " \ "ogm_reader for the temporary file.\n%s\n", error.get_error()); exit(1); } ogm_reader->overwrite_eos(1); memcpy(&nosync, &async, sizeof(audio_sync_t)); async.displacement = 0; async.linear = 1.0; status = ogm_reader->read(); mpage = ogm_reader->get_header_page(); free(mpage->og->header); free(mpage->og->body); free(mpage->og); free(mpage); skip_packets = 2; old_packetizer = ogm_reader->set_packetizer(this); while (status == EMOREDATA) status = ogm_reader->read(); ogm_reader->set_packetizer(old_packetizer); delete ogm_reader; verbose = old_verbose; unlink(tmpname); memcpy(&async, &nosync, sizeof(audio_sync_t)); } void vorbis_packetizer_c::reset() { } void vorbis_packetizer_c::produce_header_packets() { vorbis_info_init(&vi); vorbis_comment_init(&vc); vorbis_synthesis_headerin(&vi, &vc, header_packet); packetno = 1; ogran = header_packet->granulepos; ogg_stream_packetin(&os, header_packet); flush_pages(PACKET_TYPE_HEADER); /* * Convert the range parameters from seconds to samples for easier handling * later on. */ if (!range_converted) { range.start *= vi.rate; range.end *= vi.rate; range_converted = 1; } } /* * Some notes - processing is straight-forward if no AV synchronization * is needed - the packet is simply handed over to ogg_stream_packetin. * Unfortunately things are not that easy if AV sync is done. For a * negative displacement packets are simply discarded if their granulepos * is set before the displacement. For positive displacements the packetizer * has to generate silence and insert this silence just after the first * three stream packets - the Vorbis header, the comment and the * setup packets. * The creation of the silence is done by encoding 0 samples with * libvorbis. This produces an OGG file that is read by a separate * ogm_reader_c. We set this very packetizer as the reader's packetizer * so that we get the packets we want from the 'silenced' file. This means * skipping the very first three packets, hence the 'skip_packets' variable. */ int vorbis_packetizer_c::process(ogg_packet *op, ogg_int64_t gran) { ogg_int64_t this_granulepos; /* * We might want to skip a certain amount of packets if this packetizer * is used by a second ogm_reader_c, one that reads from a 'silence' * file. skip_packets is then intially set to 3 in order to skip all * header packets. */ if (skip_packets > 0) { skip_packets--; return EMOREDATA; } // The initial packet has the headers that we get our informations from. if (packetno == 0) { header_packet = duplicate_ogg_packet(op); produce_header_packets(); } else if (packetno == 1) { /* * This is the comment packet. If the user supplied a comment string * via the command line then the current comments are replaced by them. * Otherwise simply copy the comments. */ if ((comments == NULL) || (comments->comments == 0)) { ogg_stream_packetin(&os, op); } else { int clen, res; ogg_packet cop; clen = -1 * comments_to_buffer(comments, NULL, 0); cop.packet = (unsigned char *)mmalloc(clen); cop.bytes = clen; cop.b_o_s = 0; cop.e_o_s = 0; cop.granulepos = 0; cop.packetno = 1; res = comments_to_buffer(comments, (char *)cop.packet, clen); if (res < 0) { fprintf(stderr, "FATAL: p_vorbis: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &cop); free(cop.packet); } flush_pages(PACKET_TYPE_COMMENT); packetno++; } else { // Recalculate the granulepos if needed. if (op->granulepos == -1) op->granulepos = gran; /* * Handle the displacements - but only if the packet itself is not * a header packet. */ if ((async.displacement > 0) && (packetno > 2)) op->granulepos += vi.rate * async.displacement / 1000; else if ((packetno > 2) && (async.displacement < 0)) op->granulepos += vi.rate * async.displacement / 1000; // Handle the linear sync - simply multiply with the given factor. op->granulepos = (u_int64_t)((double)op->granulepos * async.linear); this_granulepos = op->granulepos; if (packetno == 2) { /* * The first three packets have to be copied as they are all header/ * comments/setup packets. */ ogg_stream_packetin(&os, op); flush_pages(); packetno++; setup_displacement(); } // range checking else if ((op->granulepos >= range.start) && (last_granulepos_seen >= range.start) && ((range.end == 0) || (op->granulepos <= range.end))) { // Adjust the granulepos op->granulepos = (u_int64_t)(op->granulepos - range.start); // If no or a positive displacement is set the packet has to be output. if (async.displacement >= 0) { ogg_stream_packetin(&os, op); packetno++; } /* * Only output the current packet if its granulepos ( = position in * samples) is bigger than the displacement. */ else if (op->granulepos > 0) { ogg_stream_packetin(&os, op); packetno++; } queue_pages(); last_granulepos = op->granulepos; } else if (op->e_o_s) { ogg_packet p; unsigned char c = 0; flush_pages(); memcpy(&p, op, sizeof(ogg_packet)); p.granulepos = last_granulepos; p.packet = &c; p.bytes = 1; ogg_stream_packetin(&os, &p); flush_pages(); packetno++; } last_granulepos_seen = this_granulepos; } return EMOREDATA; } void vorbis_packetizer_c::produce_eos_packet() { ogg_packet op; op.packet = (unsigned char *)""; op.bytes = 1; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = ogran; op.packetno = 99999999; process(&op, ogran); } stamp_t vorbis_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; if (vi.rate == 0) die("vi.rate == 0!"); #ifndef INCORRECT_INTERLEAVING if (granulepos == -1) stamp = (u_int64_t)((double)old_granulepos * (double)1000000 / (double)vi.rate); else { stamp = (u_int64_t)((double)old_granulepos * (double)1000000 / (double)vi.rate); old_granulepos = granulepos; } #else if (granulepos == -1) stamp = (u_int64_t)((double)granulepos * (double)1000000 / (double)vi.rate); else stamp = (u_int64_t)((double)granulepos * (double)1000000 / (double)vi.rate); #endif return stamp; } ogmtools-1.5/p_video.cpp0000644000076400234220000001661607655160106015023 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_video.cpp video output module (DivX, XviD, not MPEG1/2) Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "p_video.h" #include "vorbis_header_utils.h" video_packetizer_c::video_packetizer_c(char *ncodec, double nfps, int nwidth, int nheight, int nbpp, int nmax_frame_size, audio_sync_t *as, range_t *nrange, char **ncomments) throw (error_c) : q_c() { serialno = create_unique_serial(); ogg_stream_init(&os, serialno); packetno = 0; memcpy(codec, ncodec, 4); codec[4] = 0; fps = nfps; width = nwidth; height = nheight; bpp = nbpp; max_frame_size = nmax_frame_size; last_granulepos = 0; tempbuf = (char *)malloc(max_frame_size + 1); memcpy(&range, nrange, sizeof(range_t)); if (tempbuf == NULL) die("malloc"); range.start *= fps; range.end *= fps; old_granulepos = 0; chapter_info = NULL; comments = generate_vorbis_comment(ncomments); #ifdef ENABLE_INDEX add_index(serialno); #endif } void video_packetizer_c::reset() { } #define isequal(s) (*(s) == '=') #define istwodigits(s) (isdigit(*(s)) && isdigit(*(s + 1))) vorbis_comment *video_packetizer_c::strip_chapters() { int i, done; vorbis_comment *new_vc; if (comments == NULL) return NULL; new_vc = vorbis_comment_dup(comments); do { for (i = 0; i < new_vc->comments; i++) { done = 1; if ((new_vc->comment_lengths[i] >= 14) && !strncmp(new_vc->user_comments[i], "CHAPTER", 7) && ( (istwodigits(&new_vc->user_comments[i][7]) && isequal(&new_vc->user_comments[i][9])) || (istwodigits(&new_vc->user_comments[i][7]) && !strncmp(&new_vc->user_comments[i][9], "NAME", 4) && isequal(&new_vc->user_comments[i][13])) )) { vorbis_comment_remove_number(new_vc, i); done = 0; break; } } } while (!done && (new_vc->comments > 0)); return new_vc; } void video_packetizer_c::produce_header_packets() { stream_header sh; int vclen; ogg_packet op; vorbis_comment *new_comments, *new_comments2; *((unsigned char *)tempbuf) = PACKET_TYPE_HEADER; memset(&sh, 0, sizeof(stream_header)); strcpy(sh.streamtype, "video"); memcpy(sh.subtype, codec, 4); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, (ogg_int64_t)((double)10000000.0 / (double)fps)); sample_rate = (double)10000000 / (double)get_uint64(&sh.time_unit); put_uint64(&sh.samples_per_unit, 1); put_uint32(&sh.default_len, 1); put_uint32(&sh.buffersize, max_frame_size); put_uint16(&sh.bits_per_sample, bpp); put_uint32(&sh.sh.video.width, width); put_uint32(&sh.sh.video.height, height); memcpy(&tempbuf[1], &sh, sizeof(stream_header)); op.packet = (unsigned char *)tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); if (chapter_info != NULL) { new_comments = strip_chapters(); new_comments = vorbis_comment_cat(new_comments, chapter_info); } else new_comments = vorbis_comment_dup(comments); new_comments2 = chapter_information_adjust(new_comments, (range.start / fps) * 1000.0, (range.end == 0.0) ? 99999999999.0 : (range.end / fps) * 1000.0); if (new_comments2 != NULL) { vorbis_comment_clear(new_comments); free(new_comments); new_comments = new_comments2; } vclen = comments_to_buffer(new_comments, tempbuf, max_frame_size + 1); if (vclen < 0) { fprintf(stderr, "FATAL: p_video: buffer too small for %d bytes " \ "(can hold %d bytes).\n", vclen, max_frame_size + 1); exit(1); } if (new_comments != NULL) { vorbis_comment_clear(new_comments); free(new_comments); } op.packet = (unsigned char *)tempbuf; op.bytes = vclen; op.b_o_s = 0; op.e_o_s = 0; op.packetno = 1; op.granulepos = 0; ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; } int video_packetizer_c::process(char *buf, int size, int num_frames, int key, int last_frame) { ogg_packet op; int offset; if (size > max_frame_size) { fprintf(stderr, "FATAL: p_video: size (%d) > max_frame_size (%d)\n", size, max_frame_size); exit(1); } if (packetno == 0) produce_header_packets(); if ((packetno >= range.start) && ((range.end == 0) || (packetno < range.end))) { if (key) { flush_pages(); next_page_contains_keyframe(serialno); } *((unsigned char *)tempbuf) = key ? PACKET_IS_SYNCPOINT : 0; if (num_frames == 1) offset = 0; else { unsigned char *bptr; int nf, idx; for (offset = 3; offset >= 0; offset--) if (num_frames > (1 << (8 * offset))) break; offset++; tempbuf[0] |= (((offset & 3) << 6) + ((offset & 4) >> 1)); bptr = (unsigned char *)&tempbuf[1]; nf = num_frames; for (idx = 0; idx < offset; idx++) { *(bptr + idx) = (unsigned char)(nf & 0xFF); nf >>= 8; } } memcpy(&tempbuf[1 + offset], buf, size); op.bytes = size + 1 + offset; op.packet = (unsigned char *)tempbuf; op.b_o_s = 0; op.e_o_s = last_frame; op.granulepos = last_granulepos + num_frames - 1; op.packetno = packetno; ogg_stream_packetin(&os, &op); queue_pages(); last_granulepos += num_frames; } else if (last_frame) { *((unsigned char *)tempbuf) = 0; op.bytes = 1; op.packet = (unsigned char *)tempbuf; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = last_granulepos; op.packetno = packetno; ogg_stream_packetin(&os, &op); flush_pages(); last_granulepos++; } packetno++; return EMOREDATA; } void video_packetizer_c::produce_eos_packet() { char buf = 0; process(&buf, 1, 1, 0, 1); } video_packetizer_c::~video_packetizer_c() { if (tempbuf != NULL) free(tempbuf); ogg_stream_clear(&os); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } if (chapter_info != NULL) { vorbis_comment_clear(chapter_info); free(chapter_info); } } void video_packetizer_c::set_chapter_info(vorbis_comment *vc) { if (chapter_info != NULL) { vorbis_comment_clear(chapter_info); free(chapter_info); } chapter_info = vorbis_comment_dup(vc); } stamp_t video_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef INCORRECT_INTERLEAVING stamp = (stamp_t)((double)old_granulepos * (double)1000000.0 / sample_rate); old_granulepos = granulepos; #else stamp = (stamp_t)((double)granulepos * (double)1000000.0 / sample_rate); #endif return stamp; } ogmtools-1.5/r_microdvd.cpp0000644000076400234220000001352607655160106015523 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_microdvd.cpp MicroDVD text subtitle reader module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_microdvd.h" #include "subtitles.h" int microdvd_reader_c::probe_file(FILE *file, off_t size) { char chunk[2048]; int i; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fgets(chunk, 2047, file) == NULL) return 0; if ((chunk[0] != '{') || !isdigit(chunk[1])) return 0; i = 2; while (isdigit(chunk[i])) i++; if ((chunk[i] != '}') || (chunk[i + 1] != '{')) return 0; i += 2; while (isdigit(chunk[i])) i++; if ((chunk[i] != '}') || (chunk[i + 1] == 0) || (chunk[i + 1] == '\n') || (chunk[i + 1] == '\r')) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; return 1; } microdvd_reader_c::microdvd_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) { if ((file = fopen(fname, "r")) == NULL) throw error_c("microdvd_reader: Could not open source file."); if (!microdvd_reader_c::probe_file(file, 0)) throw error_c("microdvd_reader: Source is not a valid MicroDVD file."); textsubspacketizer = new textsubs_packetizer_c(nasync, nrange, ncomments); if (verbose) fprintf(stderr, "Using MicroDVD subtitle reader for %s.\n+-> Using " \ "text subtitle output module for subtitles.\n", fname); } microdvd_reader_c::~microdvd_reader_c() { if (textsubspacketizer != NULL) delete textsubspacketizer; } int microdvd_reader_c::read() { ogg_int64_t start, end; char *subtitles, *s, *s2; subtitles_c subs; int i, j, lineno; if (video_fps < 0.0) { fprintf(stderr, "microdvd_reader: You have to add a video source before " "a MicroDVD source. Otherwise the frame numbers cannot be " "converted to time stamps."); exit(1); } lineno = 0; while (1) { if (fgets(chunk, 2047, file) == NULL) break; lineno++; // {123}{4567}Some text|and even another line. if ((chunk[0] == 0) || (strchr("\n\r", chunk[0]) != NULL)) continue; if ((chunk[0] != '{') || !isdigit(chunk[1])) { fprintf(stdout, "microdvd_reader: Warning: Unrecognized line %d. " "Ignored.\n", lineno); continue; } i = 2; while (isdigit(chunk[i])) i++; if ((chunk[i] != '}') || (chunk[i + 1] != '{')) { fprintf(stdout, "microdvd_reader: Warning: Unrecognized line %d. " "Ignored.\n", lineno); continue; } chunk[i] = 0; start = strtol(&chunk[1], NULL, 10); if ((start < 0) || (errno != 0)) { fprintf(stdout, "microdvd_reader: Warning: Bad start frame '%s' on line " "%d. Ignored.\n", &chunk[1], lineno); continue; } i += 2; j = i; while (isdigit(chunk[i])) i++; if ((chunk[i] != '}') || (chunk[i + 1] == 0)) { fprintf(stdout, "microdvd_reader: Warning: Unrecognized line %d. " "Ignored.\n", lineno); continue; } if ((chunk[i + 1] == '\n') || (chunk[i + 1] == '\r')) continue; chunk[i] = 0; end = strtol(&chunk[j], NULL, 10); if ((end < 0) || (errno != 0)) { fprintf(stdout, "microdvd_reader: Warning: Bad end frame '%s' on line " "%d. Ignored.\n", &chunk[j], lineno); continue; } start = (ogg_int64_t)(start * 1000 / video_fps); end = (ogg_int64_t)(end * 1000 / video_fps); subtitles = NULL; s = &chunk[i + 1]; s2 = &s[strlen(s) - 1]; while ((s2 != s) && ((*s2 == '\n') || (*s2 == '\r'))) { *s2 = 0; s2--; } if (*s == 0) { fprintf(stdout, "microdvd_reader: Warning: Unrecognized line %d. " "Ignored.\n", lineno); continue; } while (s != NULL) { s2 = strchr(s, '|'); if (s2 != NULL) *s2 = 0; if (subtitles == NULL) { subtitles = strdup(s); if (subtitles == NULL) die("malloc"); } else { subtitles = (char *)realloc(subtitles, strlen(s) + 2 + strlen(subtitles)); if (subtitles == NULL) die("malloc"); sprintf(&subtitles[strlen(subtitles)], "\n%s", s); } if (s2 != NULL) s = &s2[1]; else s = NULL; } if (subtitles != NULL) { subs.add(start, end, subtitles); free(subtitles); subtitles = NULL; } } if ((subs.check() != 0) && verbose) fprintf(stdout, "MicroDVD_reader: Warning: The subtitle file seems to be " "badly broken. The output file might not be playable " "correctly.\n"); subs.process(textsubspacketizer); return 0; } int microdvd_reader_c::serial_in_use(int serial) { return textsubspacketizer->serial_in_use(serial); } ogmmerge_page_t *microdvd_reader_c::get_header_page(int header_type) { return textsubspacketizer->get_header_page(header_type); } ogmmerge_page_t *microdvd_reader_c::get_page() { return textsubspacketizer->get_page(); } int microdvd_reader_c::display_priority() { return DISPLAYPRIORITY_LOW; } void microdvd_reader_c::reset() { if (textsubspacketizer != NULL) textsubspacketizer->reset(); } static char wchar[] = "-\\|/-\\|/-"; void microdvd_reader_c::display_progress() { fprintf(stdout, "working... %c\r", wchar[act_wchar]); act_wchar++; if (act_wchar == strlen(wchar)) act_wchar = 0; fflush(stdout); } ogmtools-1.5/r_srt.cpp0000644000076400234220000001140007655160106014511 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_srt.cpp SRT text subtitle reader module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_srt.h" #include "subtitles.h" #define iscolon(s) (*(s) == ':') #define iscomma(s) (*(s) == ',') #define istwodigits(s) (isdigit(*(s)) && isdigit(*(s + 1))) #define isthreedigits(s) (isdigit(*(s)) && isdigit(*(s + 1)) && \ isdigit(*(s + 2))) #define isarrow(s) (!strncmp((s), " --> ", 5)) #define istimestamp(s) (istwodigits(s) && iscolon(s + 2) && \ istwodigits(s + 3) && iscolon(s + 5) && \ istwodigits(s + 6) && iscomma(s + 8) && \ isthreedigits(s + 9)) #define issrttimestamp(s) (istimestamp(s) && isarrow(s + 12) && \ istimestamp(s + 17)) int srt_reader_c::probe_file(FILE *file, off_t size) { char chunk[2048]; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fgets(chunk, 2047, file) == NULL) return 0; if ((chunk[0] != '1') || ((chunk[1] != '\n') && (chunk[1] != '\r'))) return 0; if (fgets(chunk, 2047, file) == NULL) return 0; if ((strlen(chunk) < 29) || !issrttimestamp(chunk)) return 0; if (fgets(chunk, 2047, file) == NULL) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; return 1; } srt_reader_c::srt_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) { if ((file = fopen(fname, "r")) == NULL) throw error_c("srt_reader: Could not open source file."); if (!srt_reader_c::probe_file(file, 0)) throw error_c("srt_reader: Source is not a valid SRT file."); textsubspacketizer = new textsubs_packetizer_c(nasync, nrange, ncomments); if (verbose) fprintf(stderr, "Using SRT subtitle reader for %s.\n+-> Using " \ "text subtitle output module for subtitles.\n", fname); } srt_reader_c::~srt_reader_c() { if (textsubspacketizer != NULL) delete textsubspacketizer; } int srt_reader_c::read() { ogg_int64_t start, end; char *subtitles; subtitles_c subs; while (1) { if (fgets(chunk, 2047, file) == NULL) break; if (fgets(chunk, 2047, file) == NULL) break; if ((strlen(chunk) < 29) || !issrttimestamp(chunk)) break; // 00:00:00,000 --> 00:00:00,000 // 01234567890123456789012345678 // 1 2 chunk[2] = 0; chunk[5] = 0; chunk[8] = 0; chunk[12] = 0; chunk[19] = 0; chunk[22] = 0; chunk[25] = 0; chunk[29] = 0; start = atol(chunk) * 3600000 + atol(&chunk[3]) * 60000 + atol(&chunk[6]) * 1000 + atol(&chunk[9]); end = atol(&chunk[17]) * 3600000 + atol(&chunk[20]) * 60000 + atol(&chunk[23]) * 1000 + atol(&chunk[26]); subtitles = NULL; while (1) { if (fgets(chunk, 2047, file) == NULL) break; if ((*chunk == '\n') || (*chunk == '\r')) break; if (subtitles == NULL) { subtitles = strdup(chunk); if (subtitles == NULL) die("malloc"); } else { subtitles = (char *)realloc(subtitles, strlen(chunk) + 1 + strlen(subtitles)); if (subtitles == NULL) die("malloc"); strcat(subtitles, chunk); } } if (subtitles != NULL) { subs.add(start, end, subtitles); free(subtitles); } } if ((subs.check() != 0) && verbose) fprintf(stdout, "srt_reader: Warning: The subtitle file seems to be " \ "badly broken. The output file might not be playable " \ "correctly.\n"); subs.process(textsubspacketizer); return 0; } int srt_reader_c::serial_in_use(int serial) { return textsubspacketizer->serial_in_use(serial); } ogmmerge_page_t *srt_reader_c::get_header_page(int header_type) { return textsubspacketizer->get_header_page(header_type); } ogmmerge_page_t *srt_reader_c::get_page() { return textsubspacketizer->get_page(); } int srt_reader_c::display_priority() { return DISPLAYPRIORITY_LOW; } void srt_reader_c::reset() { if (textsubspacketizer != NULL) textsubspacketizer->reset(); } static char wchar[] = "-\\|/-\\|/-"; void srt_reader_c::display_progress() { fprintf(stdout, "working... %c\r", wchar[act_wchar]); act_wchar++; if (act_wchar == strlen(wchar)) act_wchar = 0; fflush(stdout); } ogmtools-1.5/p_index.h0000644000076400234220000000210507655160106014455 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_index.h class definition for video index Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifdef ENABLE_INDEX #ifndef __P_INDEX_H #define __P_INDEX_H #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" typedef struct idx_entry { ogg_int64_t granulepos; off_t filepos; }; class index_packetizer_c: public q_c { private: ogg_int64_t granulepos, packetno; int serial; public: index_packetizer_c(int nserial) throw (error_c); virtual ~index_packetizer_c(); virtual int process(idx_entry *entries, int num); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); }; #endif #endif // ENABLE_INDEX ogmtools-1.5/ogminfo.c0000644000076400234220000004616007757237160014501 0ustar mosuvj00000000000000/* ogminfo -- utility for getting informations about an OGG media file Written by Moritz Bunkus Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include #include #include #include "common.h" #include "ogmstreams.h" #include "vorbis_header_utils.h" #define BLOCK_SIZE 4096 //#define BLOCK_SIZE 1 typedef struct stream_t { int serial; int fd; int vorbis; double sample_rate; int eos, comment; int sno; char stype; int header_packets; ogg_stream_state state; ogg_int64_t last_granulepos, this_granulepos, biggest_granulepos; ogg_int64_t num_packets; u_int64_t size; struct stream_t *next; } stream_t; stream_t *first; int nastreams = 0, nvstreams = 0, ntstreams = 0, nistreams = 0; int numstreams = 0; int headers_read = 0; ogg_int64_t pagebytesread = 0; void add_stream(stream_t *ndmx) { stream_t *cur = first; if (first == NULL) { first = ndmx; first->next = NULL; } else { cur = first; while (cur->next != NULL) cur = cur->next; cur->next = ndmx; ndmx->next = NULL; } } stream_t *find_stream(int fserial) { stream_t *cur = first; while (cur != NULL) { if (cur->serial == fserial) break; cur = cur->next; } return cur; } int verbose = 0; int check_timing = 0; int summary = 0; void usage(char *fname) { fprintf(stdout, "Usage: %s [options] inname\n\n" " options:\n" " inname Use 'inname' as the source.\n" " -v, --verbose Increase verbosity. See the man page for a detailed\n" " description of what ogminfo outputs.\n" " -s, --summary Print a summary for each track.\n" " -h, --help Show this help.\n" " -V, --version Show version information.\n", fname); } #ifndef XIPHCORRECTINTERLEAVING #define OUTOFSYNC ((((stream->stype == 't' ? end_pts : start_pts) \ - last_pts) < 0.0 ) ? "OUT_OF_SYNC " : "sync_ok ") #else #define OUTOFSYNC (((start_pts - last_pts) < 0.0 ) ? \ "OUT_OF_SYNC " : "sync_ok ") #endif #define ISSYNCPOINT ((pack->packet[0] & PACKET_IS_SYNCPOINT) ? \ "IS_SYNCPOINT " : "") #define E_O_S (pack->e_o_s ? "EOS " : "") double start_pts, end_pts, last_pts; void dump_streamheader(stream_header *sth, char stype, int sno, int snum) { char streamtype[9], subtype[5]; memcpy(streamtype, sth->streamtype, 8); streamtype[8] = 0; memcpy(subtype, sth->subtype, 4); subtype[4] = 0; fprintf(stdout, "(%s) (%c%d/serial %d) Full stream_header dump: {" "streamtype = \"%s\", subtype = \"%s\", size = %d, " "time_unit = %lld, samples_per_unit = %lld, default_len = %d, " "buffersize = %d, bits_per_sample = %d, " "sh = { video = { width = %d, height = %d} / audio = { " "channels = %d, blockalign = %d, avgbytespersec = %d } }\n", __FILE__, stype, sno, snum, streamtype, subtype, get_uint32(&sth->size), get_uint64(&sth->time_unit), get_uint64(&sth->samples_per_unit), get_uint32(&sth->default_len), get_uint32(&sth->buffersize), get_uint16(&sth->bits_per_sample), get_uint32(&sth->sh.video.width), get_uint32(&sth->sh.video.height), get_uint16(&sth->sh.audio.channels), get_uint16(&sth->sh.audio.blockalign), get_uint32(&sth->sh.audio.avgbytespersec)); } int all_header_packets_dumped() { stream_t *stream = first; while (stream != NULL) { if ((stream->stype == 'V') && (stream->header_packets < 3)) return 0; if (stream->header_packets < 2) return 0; stream = stream->next; } return 1; } void handle_packet(stream_t *stream, ogg_packet *pack, ogg_page *page) { if ((verbose == 1) && headers_read && all_header_packets_dumped() && !summary) exit(0); if (pack->e_o_s) stream->eos = 1; if (ogg_page_granulepos(page) > stream->biggest_granulepos) stream->biggest_granulepos = ogg_page_granulepos(page); stream->num_packets++; stream->size += (u_int64_t)pack->bytes; if (verbose == 0) return; if ((*pack->packet & 3) == PACKET_TYPE_HEADER) { stream->header_packets++; if (verbose < 2) return; fprintf(stdout, "(%s) %c%d: header packet, length %ld\n", __FILE__, stream->stype, stream->sno, pack->bytes); } else if ((*pack->packet & 3) == PACKET_TYPE_COMMENT) { int i; vorbis_comment vc; stream->header_packets++; stream->comment = 1; if (verbose < 1) return; vorbis_comment_init(&vc); if (vorbis_unpack_comment(&vc, pack->packet, pack->bytes) != 0) fprintf(stdout, "(%s) %c%d: comment packet, length %ld. This packet " "does NOT contain a valid Vorbis comment packet!\n", __FILE__, stream->stype, stream->sno, pack->bytes); else { fprintf(stdout, "(%s) %c%d: comment packet, length %ld,", __FILE__, stream->stype, stream->sno, pack->bytes); if (vc.comments > 0) { fprintf(stdout, " %d user comment field%s:\n", vc.comments, vc.comments != 1 ? "s" : ""); for (i = 0; i < vc.comments; i++) fprintf(stdout, "(%s) %c%d: %s\n", __FILE__, stream->stype, stream->sno, vc.user_comments[i]); } else fprintf(stdout, " no user comment fields available.\n"); } vorbis_comment_clear(&vc); } else if ((stream->stype == 'a') && stream->vorbis) { if (verbose < 1) return; fprintf(stdout, "(%s) a%d: % 7ld bytes granulepos: % 10lld pno: % 10lld ", __FILE__, stream->sno, pack->bytes, ogg_page_granulepos(page), pack->packetno); if (check_timing && (stream->sample_rate != -1)) { end_pts = (double)ogg_page_granulepos(page) * (double)1000.0 / (double)stream->sample_rate; start_pts = (double)stream->last_granulepos * (double)1000.0 / (double)stream->sample_rate; fprintf(stdout, " start: % 13.2fms end: % 13.2fms %s", start_pts, end_pts, OUTOFSYNC); last_pts = start_pts; } fprintf(stdout, "%s%s\n", ISSYNCPOINT, E_O_S); } else { int hdrlen, i; long lenbytes = 0, n; if (verbose < 2) return; hdrlen = (*pack->packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*pack->packet & PACKET_LEN_BITS2) << 1; n = pack->bytes - 1 - hdrlen; for (i = 0; i < hdrlen; i++) { lenbytes = lenbytes << 8; lenbytes += *((unsigned char *)pack->packet + hdrlen - i); } if (stream->stype == 'i') fprintf(stdout, "(%s) i%d: % 7ld bytes", __FILE__, stream->sno, n); else { fprintf(stdout, "(%s) %c%d: % 7ld bytes granulepos: % 10lld pno: % " "10lld ", __FILE__, stream->stype, stream->sno, n, ogg_page_granulepos(page), pack->packetno); if (check_timing && (stream->sample_rate != -1)) { end_pts = (double)ogg_page_granulepos(page) * (double)1000.0 / (double)stream->sample_rate; start_pts = (double)stream->last_granulepos * (double)1000.0 / (double)stream->sample_rate; fprintf(stdout, " start: % 13.2fms end: % 13.2fms %s", start_pts, end_pts, OUTOFSYNC); last_pts = start_pts; } fprintf(stdout, " hdrlen: %d", hdrlen); if (hdrlen > 0) fprintf(stdout, " duration: %ld", lenbytes); } fprintf(stdout, " %s%s\n", ISSYNCPOINT, E_O_S); } } void process_ogm(int fdin) { ogg_sync_state sync; ogg_page page; ogg_packet pack; ogg_stream_state sstate; vorbis_info vi; vorbis_comment vc; char *buf; int nread, serialnumber; int endofstream = 0; stream_t *stream; long pageseek; last_pts = 0.0; start_pts = 0.0; end_pts = 0.0; ogg_sync_init(&sync); while (1) { pageseek = ogg_sync_pageseek(&sync, &page); if (pageseek < 0) { fprintf(stderr, "(%s) ogg_sync_pageseek failed\n", __FILE__); return; } else if (pageseek == 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); if (!buf) { fprintf(stderr, "(%s) ogg_sync_buffer failed\n", __FILE__); return; } if ((nread = read(fdin, buf, BLOCK_SIZE)) <= 0) { if (verbose > 1) fprintf(stdout, "(%s) end of stream\n", __FILE__); return; } ogg_sync_wrote(&sync, nread); continue; } pagebytesread += pageseek; if (!ogg_page_bos(&page)) break; if (verbose > 2) fprintf(stdout, "(%s) NEW PAGE pos: % 12lld, len: % 12ld, body_len: " "% 12ld\n", __FILE__, pagebytesread - pageseek, pageseek, page.body_len); serialnumber = ogg_page_serialno(&page); if (ogg_stream_init(&sstate, serialnumber)) { fprintf(stderr, "(%s) ogg_stream_init failed\n", __FILE__); return; } ogg_stream_pagein(&sstate, &page); ogg_stream_packetout(&sstate, &pack); if ((pack.bytes >= 7) && ! strncmp(&pack.packet[1], "vorbis", 6)) { stream = (stream_t *)mmalloc(sizeof(stream_t)); stream->serial = serialnumber; stream->vorbis = 1; stream->sample_rate = -1; stream->sno = nastreams + 1; stream->stype = 'a'; memcpy(&stream->state, &sstate, sizeof(sstate)); vorbis_info_init(&vi); vorbis_comment_init(&vc); if (vorbis_synthesis_headerin(&vi, &vc, &pack) >= 0) { fprintf(stdout, "(%s) (a%d/serial %d) Vorbis audio (channels %d " "rate %ld)\n", __FILE__, nastreams + 1, serialnumber, vi.channels, vi.rate); stream->sample_rate = vi.rate; } else fprintf(stdout, "(%s) (a%d/serial %d) Vorbis audio stream indicated " "but no Vorbis stream header found.\n", __FILE__, nastreams + 1, serialnumber); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->state, &pack) == 1); add_stream(stream); nastreams++; numstreams++; } else if ((pack.bytes >= 142) && !strncmp(&pack.packet[1],"Direct Show Samples embedded in Ogg", 35) ) { if ((get_uint32(pack.packet+96) == 0x05589f80) && (pack.bytes >= 184)) { fprintf(stdout, "(%s) (v%d/serial %d) Found old video header. Not " "supported.\n", __FILE__, nvstreams + 1, serialnumber); } else if (get_uint32(pack.packet+96) == 0x05589F81) { fprintf(stdout, "(%s) (a%d/serial %d) Found old audio header. Not " "supported.\n", __FILE__, nastreams + 1, serialnumber); } else { if (verbose > 0) fprintf(stdout, "(%s) OGG stream %d, serial %d, has an old header " "with an unknown type.", __FILE__, numstreams + 1, serialnumber); numstreams++; } } else if (((*pack.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER) && (pack.bytes >= (int)(sizeof(old_stream_header) + 1))) { stream_header sth; copy_headers(&sth, (old_stream_header *)&pack.packet[1], pack.bytes); if (!strncmp(sth.streamtype, "video", 5)) { unsigned long codec; codec = (sth.subtype[0] << 24) + (sth.subtype[1] << 16) + (sth.subtype[2] << 8) + sth.subtype[3]; fprintf(stdout, "(%s) (v%d/serial %d) fps: %.3f width height: %dx%d " "codec: %p (%c%c%c%c)\n", __FILE__, nvstreams + 1, serialnumber, (double)10000000 / (double)get_uint64(&sth.time_unit), get_uint32(&sth.sh.video.width), get_uint32(&sth.sh.video.height), (void *)codec, sth.subtype[0], sth.subtype[1], sth.subtype[2], sth.subtype[3]); if (verbose > 3) dump_streamheader(&sth, 'v', nvstreams + 1, serialnumber); stream = (stream_t *)mmalloc(sizeof(stream_t)); stream->stype = 'v'; stream->serial = serialnumber; stream->sample_rate = (double)10000000 / (double)get_uint64(&sth.time_unit); stream->sno = nvstreams + 1; memcpy(&stream->state, &sstate, sizeof(sstate)); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->state, &pack) == 1); add_stream(stream); nvstreams++; numstreams++; } else if (!strncmp(sth.streamtype, "audio", 5)) { int codec; char buf[5]; memcpy(buf, sth.subtype, 4); buf[4] = 0; codec = strtoul(buf, NULL, 16); fprintf(stdout, "(%s) (a%d/serial %d) codec: %d (0x%04x) (%s) bits " "per sample: %d channels: %d samples per second: %lld" " avgbytespersec: %d blockalign: %hd\n", __FILE__, nastreams + 1, serialnumber, codec, codec, codec == 0x1 ? "PCM" : codec == 55 ? "MP3" : codec == 0x55 ? "MP3" : codec == 0x2000 ? "AC3" : "unknown", get_uint16(&sth.bits_per_sample), get_uint16(&sth.sh.audio.channels), get_uint64(&sth.samples_per_unit), get_uint32(&sth.sh.audio.avgbytespersec), get_uint16(&sth.sh.audio.blockalign)); if (verbose > 3) dump_streamheader(&sth, 'a', nastreams + 1, serialnumber); stream = (stream_t *)mmalloc(sizeof(stream_t)); stream->sno = nastreams + 1; stream->stype = 'a'; stream->sample_rate = get_uint64(&sth.samples_per_unit); stream->serial = serialnumber; memcpy(&stream->state, &sstate, sizeof(sstate)); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->state, &pack) == 1); add_stream(stream); nastreams++; numstreams++; } else if (!strncmp(sth.streamtype, "text", 4)) { fprintf(stdout, "(%s) (t%d/serial %d) text/subtitle stream\n", __FILE__, ntstreams + 1, serialnumber); if (verbose > 3) dump_streamheader(&sth, 't', ntstreams + 1, serialnumber); stream = (stream_t *)mmalloc(sizeof(stream_t)); stream->sno = ntstreams + 1; stream->stype = 't'; stream->sample_rate = (double)10000000 / (double)get_uint64(&sth.time_unit); stream->serial = serialnumber; memcpy(&stream->state, &sstate, sizeof(sstate)); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->state, &pack) == 1); add_stream(stream); ntstreams++; numstreams++; } else if (!strncmp(sth.streamtype, "index", 5)) { int idx_serial; idx_serial = *((int *)&sth.subtype[0]); fprintf(stdout, "(%s) (i%d/serial %d) index stream for video stream " "with the serial %d\n", __FILE__, nistreams + 1, serialnumber, idx_serial); stream = (stream_t *)mmalloc(sizeof(stream_t)); stream->sno = nistreams + 1; stream->stype = 'i'; stream->sample_rate = 0; stream->serial = serialnumber; memcpy(&stream->state, &sstate, sizeof(sstate)); do handle_packet(stream, &pack, &page); while (ogg_stream_packetout(&stream->state, &pack) == 1); add_stream(stream); nistreams++; numstreams++; } else { fprintf(stdout, "(%s) (%d) found new header of unknown/" "unsupported type\n", __FILE__, numstreams + 1); numstreams++; } } else { fprintf(stdout, "(%s) OGG stream %d is of an unknown type " "(bad header?)\n", __FILE__, numstreams + 1); numstreams++; } } if ((verbose == 0) && !summary) exit(0); headers_read = 1; endofstream = 0; while (!endofstream) { serialnumber = ogg_page_serialno(&page); stream = find_stream(serialnumber); if (stream == NULL) { if (verbose > 2) fprintf(stdout, "(%s) Encountered packet for an unknown serial " "%d !?\n", __FILE__, serialnumber); } else { if (verbose > 2) fprintf(stdout, "(%s) %c%d: NEW PAGE pos: % 12lld, len: % 12ld, " "body_len: % 12ld\n", __FILE__, stream->stype, stream->sno, pagebytesread - pageseek, pageseek, page.body_len); ogg_stream_pagein(&stream->state, &page); stream->last_granulepos = stream->this_granulepos; stream->this_granulepos = ogg_page_granulepos(&page); while (ogg_stream_packetout(&stream->state, &pack) == 1) handle_packet(stream, &pack, &page); } while ((pageseek = ogg_sync_pageseek(&sync, &page)) <= 0) { buf = ogg_sync_buffer(&sync, BLOCK_SIZE); nread = read(fdin, buf, BLOCK_SIZE); if (nread <= 0) { stream = first; while (stream != NULL) { if (stream->eos == 0) fprintf(stdout, "(%s) (%c%d/serial %d) end-of-stream marker " "missing\n", __FILE__, stream->stype, stream->sno, stream->serial); if ((stream->comment != 1) && (verbose >= 1)) fprintf(stdout, "(%s) (%c%d/serial %d) comment packet missing\n", __FILE__, stream->stype, stream->sno, stream->serial); stream = stream->next; } if (verbose > 1) fprintf(stdout, "(%s) end of stream\n", __FILE__); endofstream = 1; break; } else ogg_sync_wrote(&sync, nread); } pagebytesread += pageseek; } if (summary) { stream = first; while (stream != NULL) { double now; now = stream->biggest_granulepos / (double)stream->sample_rate; fprintf(stdout, "(%s) (%c%d/serial %d) stream size: %llu bytes (%.3f " "kbit/s, %.3f KB/s), number of packets: %lld, length in " "seconds: %.3f\n", __FILE__, stream->stype, stream->sno, stream->serial, stream->size, (stream->size * 8.0 / 1000.0) / now, (stream->size / 1024.0) / now, stream->num_packets, now * 1000.0); stream = stream->next; } } } int main(int argc, char *argv[]) { int i, fdin = -1; nice(2); for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { fprintf(stdout, "ogminfo v" VERSION "\n"); exit(0); } for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-v")) { check_timing = 1; verbose++; } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { usage(argv[0]); return 0; } else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--summary")) summary = 1; else { fdin = open(argv[i], O_RDONLY); if (fdin == -1) { fprintf(stderr, "(%s) Could not open \"%s\".\n", __FILE__, argv[i]); return 1; } } } if (fdin == -1) { usage(argv[0]); exit(1); } if (verbose >= 2) summary = 1; process_ogm(fdin); close(fdin); return 0; } ogmtools-1.5/ogmdemux.10000644000076400234220000000436710143371176014576 0ustar mosuvj00000000000000.TH OGMDEMUX "1" "November 2004" "ogmdemux v1.5" "User Commands" .SH NAME ogmdemux \- Extract streams from OGG/OGM files into separate files .SH SYNOPSIS .B ogmdemux [\fIoptions\fR] \fIinname\fR .SH DESCRIPTION .LP This program extracts all or only some streams from an OGM and writes them to separate files. .TP \fIinname\fR Use '\fIinname\fR' as the source. .TP \fB\-o\fR, \fB\-\-output\fR \fIout\fR Use '\fIout\fR' as the base for destination file names. \&'-v1', '-v2', '-a1', '-t1'... will be appended to this name. Default: use '\fIinname\fR'. .TP \fB\-a\fR, \fB\-\-astream\fR \fIn\fR Extract specified audio stream. Can be used more than once. Default: extract all streams. .TP \fB\-d\fR, \fB\-\-vstream\fR \fIn\fR Extract specified video stream. Can be used more than once. Default: extract all streams. .TP \fB\-t\fR, \fB\-\-tstream\fR \fIn\fR Extract specified text stream. Can be used more than once. Default: extract all streams. .TP \fB\-na\fR, \fB\-\-noaudio\fR Don't extract any audio streams. .TP \fB\-nv\fR, \fB\-\-novideo\fR Don't extract any video streams. .TP \fB\-nt\fR, \fB\-\-notext\fR Don't extract any text streams. Default: extract all streams. .TP \fB\-r\fR, \fB\-\-raw\fR Extract the raw streams only. Default: extract to useful formats (AVI, WAV, OGG, SRT...). .TP \fB\-v\fR, \fB\-\-verbose\fR Increase verbosity. .TP \fB\-h\fR, \fB\-\-help\fR Show this help. .TP \fB\-V\fR,\fB \-\-version\fR Show version number. .SH NOTES What works: .TP * Extraction of the following formats is fully supported including writing the stream contents to useful container formats: .br video -> AVI .br Vorbis -> OGG/Vorbis .br PCM -> WAV .br text -> text files (SRT subtitle format) .TP * All other audio streams (MP3, AC3) are just copied 1:1 into output files. MP3 and AC3 files should be usable. Others might not. .LP What not works: .TP * Headers created by older OggDS (DirectShow) filter versions are not supported (and probably never will be). .SH AUTHOR .I ogmdemux was written by Moritz Bunkus . .SH SEE ALSO .BR ogmmerge (1), .BR ogmsplit (1), .BR ogminfo (1), .BR ogmcat (1), .BR dvdxchap (1) .SH WWW The newest version can always be found at .UR http://www.bunkus.org/videotools/ogmtools/ .UE ogmtools-1.5/r_ogm.cpp0000644000076400234220000006123710012136675014473 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_ogm.cpp OGG demultiplexer module (supports both the 'flat' Vorbis-only OGG files and the OGG files produced by ogmmerge itself) Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_ogm.h" #include "p_vorbis.h" #include "p_video.h" #include "p_pcm.h" #include "p_textsubs.h" #include "p_mp3.h" #include "p_ac3.h" #include "vorbis_header_utils.h" /* * Probes a file by simply comparing the first four bytes to 'OggS'. */ int ogm_reader_c::probe_file(FILE *file, off_t size) { char data[4]; if (size < 4) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fread(data, 1, 4, file) != 4) { fseeko(file, 0, SEEK_SET); return 0; } fseeko(file, 0, SEEK_SET); if (strncmp(data, "OggS", 4)) return 0; return 1; } /* * Opens the file for processing, initializes an ogg_sync_state used for * reading from an OGG stream. */ ogm_reader_c::ogm_reader_c(char *fname, unsigned char *astreams, unsigned char *vstreams, unsigned char *tstreams, audio_sync_t *nasync, range_t *nrange, char **ncomments, char *nfourcc) throw (error_c) { off_t size; if ((file = fopen(fname, "r")) == NULL) throw error_c("ogm_reader: Could not open source file."); if (fseeko(file, 0, SEEK_END) != 0) throw error_c("ogm_reader: Could not seek to end of file."); size = ftello(file); if (fseeko(file, 0, SEEK_SET) != 0) throw error_c("ogm_reader: Could not seek to beginning of file."); if (!ogm_reader_c::probe_file(file, size)) throw error_c("ogm_reader: Source is not a valid OGG media file."); ogg_sync_init(&oy); act_wchar = 0; sdemuxers = 0; nastreams = 0; nvstreams = 0; ntstreams = 0; numstreams = 0; if (astreams != NULL) this->astreams = (unsigned char *)strdup((char *)astreams); else this->astreams = NULL; if (vstreams != NULL) this->vstreams = (unsigned char *)strdup((char *)vstreams); else this->vstreams = NULL; if (tstreams != NULL) this->tstreams = (unsigned char *)strdup((char *)tstreams); else this->tstreams = NULL; if (nfourcc != NULL) { fourcc = strdup(nfourcc); if (fourcc == NULL) die("malloc"); } else fourcc = NULL; if (verbose) fprintf(stderr, "Using OGG/OGM demultiplexer for %s.\n", fname); filename = strdup(fname); if (filename == NULL) die("malloc"); memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); o_eos = 0; if (ncomments == NULL) comments = NULL; else comments = dup_comments(ncomments); read_headers(); } ogm_reader_c::~ogm_reader_c() { ogm_demuxer_t *dmx, *tmp; if (astreams != NULL) free(astreams); if (vstreams != NULL) free(vstreams); if (tstreams != NULL) free(tstreams); ogg_sync_clear(&oy); dmx = sdemuxers; while (dmx != NULL) { ogg_stream_clear(&dmx->os); delete dmx->packetizer; tmp = dmx->next; free(dmx); dmx = tmp; } if (filename != NULL) free(filename); if (comments != NULL) free_comments(comments); if (fourcc != NULL) free(fourcc); } /* * Checks whether the user wants a certain stream extracted or not. */ int ogm_reader_c::demuxing_requested(unsigned char *streams, int streamno) { int i; if (streams == NULL) return 1; for (i = 0; i < strlen((char *)streams); i++) if (streams[i] == streamno) return 1; return 0; } ogm_demuxer_t *ogm_reader_c::find_demuxer(int serialno) { ogm_demuxer_t *demuxer = sdemuxers; while (demuxer != NULL) { if (demuxer->serial == serialno) return demuxer; demuxer = demuxer->next; } return NULL; } void ogm_reader_c::flush_packetizers() { ogm_demuxer_t *demuxer; demuxer = sdemuxers; while (demuxer != NULL) { // Is the input stream at its end and has not yet flagged EOS? if (!demuxer->eos) demuxer->packetizer->produce_eos_packet(); demuxer->packetizer->flush_pages(); demuxer = demuxer->next; } return; } #define BUFFER_SIZE 4096 /* * Reads an OGG page from the stream. Returns 0 if there are no more pages * left, EMOREDATA otherwise. */ int ogm_reader_c::read_page(ogg_page *og) { int np, done, nread; char *buf; done = 0; while (!done) { np = ogg_sync_pageseek(&oy, og); // np == 0 means that there is not enough data for a complete page. if (np <= 0) { // np < 0 is the error case. Should not happen with local OGG files. if (np < 0) fprintf(stdout, "Warning: ogm_reader: ogg_sync_pageseek failed. " "This may indicate a broken file. Will try to continue.\n"); buf = ogg_sync_buffer(&oy, BUFFER_SIZE); if (!buf) { fprintf(stderr, "FATAL: ogm_reader: ogg_sync_buffer failed\n"); exit(1); } if ((nread = fread(buf, 1, BUFFER_SIZE, file)) <= 0) { flush_packetizers(); return 0; } ogg_sync_wrote(&oy, nread); } else // Alright, we have a page. done = 1; } // Here EMOREDATA actually indicates success - a page has been read. return EMOREDATA; } void ogm_reader_c::add_new_demuxer(ogm_demuxer_t *dmx) { ogm_demuxer_t *append_to; if (sdemuxers == NULL) { sdemuxers = dmx; return; } append_to = sdemuxers; while (append_to->next != NULL) append_to = append_to->next; append_to->next = dmx; } /* * Checks every demuxer if it has a page available. */ int ogm_reader_c::pages_available() { ogm_demuxer_t *dmx; if (sdemuxers == NULL) return 0; dmx = sdemuxers; while (dmx != NULL) { if (!dmx->packetizer->page_available()) return 0; dmx = dmx->next; } return 1; } /* * The page is the beginning of a new stream. Check the contents for known * stream headers. If it is a known stream and the user has requested that * it should be extracted than allocate a new packetizer based on the * stream type and store the needed data in a new ogm_demuxer_t. */ void ogm_reader_c::handle_new_stream(ogg_page *og) { ogg_stream_state new_oss; ogg_packet op; ogm_demuxer_t *dmx; stream_header sth; char *codec; if (ogg_stream_init(&new_oss, ogg_page_serialno(og))) { fprintf(stderr, "FATAL: ogm_reader: ogg_stream_init for stream number " \ "%d failed. Will try to continue and ignore this stream.", numstreams + 1); return; } // Read the first page and get its first packet. ogg_stream_pagein(&new_oss, og); ogg_stream_packetout(&new_oss, &op); /* * Check the contents for known stream headers. This one is the * standard Vorbis header. */ if ((op.bytes >= 7) && !strncmp((char *)&op.packet[1], "vorbis", 6)) { nastreams++; numstreams++; if (!demuxing_requested(astreams, nastreams)) { ogg_stream_clear(&new_oss); return; } dmx = (ogm_demuxer_t *)malloc(sizeof(ogm_demuxer_t)); if (dmx == NULL) die("malloc"); memset(dmx, 0, sizeof(ogm_demuxer_t)); try { dmx->packetizer = new vorbis_packetizer_c(&async, &range, comments); } catch (error_c error) { fprintf(stderr, "FATAL: ogm_reader: could not initialize Vorbis " \ "packetizer for stream id %d. Will try to continue and " \ "ignore this stream.\n", numstreams); free(dmx); ogg_stream_clear(&new_oss); return; } dmx->stype = OGM_STREAM_TYPE_VORBIS; dmx->serial = ogg_page_serialno(og); memcpy(&dmx->os, &new_oss, sizeof(ogg_stream_state)); dmx->sid = nastreams; add_new_demuxer(dmx); if (verbose) fprintf(stdout, "+-> Using Vorbis audio output module for stream %d.\n", numstreams); do { ((vorbis_packetizer_c *)dmx->packetizer)-> process(&op, ogg_page_granulepos(og)); if (op.e_o_s) { dmx->packetizer->flush_pages(); dmx->eos = 1; return; } } while (ogg_stream_packetout(&dmx->os, &op)); return; } // The new stream headers introduced by OggDS (see ogmstreams.h). if (((*op.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER) && (op.bytes >= ((int)sizeof(old_stream_header) + 1))) { copy_headers(&sth, (old_stream_header *)&op.packet[1], op.bytes); if (!strncmp(sth.streamtype, "video", 5)) { nvstreams++; numstreams++; if (!demuxing_requested(vstreams, nvstreams)) { ogg_stream_clear(&new_oss); return; } dmx = (ogm_demuxer_t *)malloc(sizeof(ogm_demuxer_t)); if (dmx == NULL) die("malloc"); memset(dmx, 0, sizeof(ogm_demuxer_t)); if (fourcc == NULL) codec = sth.subtype; else codec = fourcc; try { dmx->packetizer = new video_packetizer_c(codec, (double)10000000 / (double)get_uint64(&sth.time_unit), get_uint32(&sth.sh.video.width), get_uint32(&sth.sh.video.height), get_uint16(&sth.bits_per_sample), get_uint32(&sth.buffersize), NULL, &range, comments); } catch (error_c error) { fprintf(stderr, "FATAL: ogm_reader: could not initialize video " \ "packetizer for stream id %d. Will try to continue and " \ "ignore this stream.\n", numstreams); free(dmx); ogg_stream_clear(&new_oss); return; } ((video_packetizer_c *)dmx->packetizer)->set_chapter_info(chapter_info); dmx->stype = OGM_STREAM_TYPE_VIDEO; dmx->serial = ogg_page_serialno(og); memcpy(&dmx->os, &new_oss, sizeof(ogg_stream_state)); dmx->sid = nvstreams; add_new_demuxer(dmx); if (video_fps < 0) video_fps = 10000000.0 / (double)get_uint64(&sth.time_unit); if (verbose) fprintf(stdout, "+-> Using video output module for stream %d.\n", numstreams); return; } if (!strncmp(sth.streamtype, "audio", 5)) { char buf[5]; long codec_id; nastreams++; numstreams++; if (!demuxing_requested(astreams, nastreams)) { ogg_stream_clear(&new_oss); return; } memcpy(buf, (char *)sth.subtype, 4); buf[4] = 0; codec_id = strtol(buf, (char **)NULL, 16); dmx = (ogm_demuxer_t *)malloc(sizeof(ogm_demuxer_t)); if (dmx == NULL) die("malloc"); memset(dmx, 0, sizeof(ogm_demuxer_t)); switch (codec_id) { case 0x0001: // raw PCM try { dmx->packetizer = new pcm_packetizer_c(get_uint64(&sth.samples_per_unit), get_uint16(&sth.sh.audio.channels), get_uint16(&sth.bits_per_sample), &async, &range, comments); } catch (error_c error) { fprintf(stderr, "FATAL: ogm_reader: could not initialize PCM " \ "packetizer for stream id %d. Will try to continue and " \ "ignore this stream.\n", numstreams); free(dmx); ogg_stream_clear(&new_oss); return; } dmx->stype = OGM_STREAM_TYPE_PCM; if (verbose) fprintf(stdout, "+-> Using PCM output module for stream %d.\n", numstreams); break; case 0x0055: // MP3 try { dmx->packetizer = new mp3_packetizer_c(get_uint64(&sth.samples_per_unit), get_uint16(&sth.sh.audio.channels), get_uint32(&sth.sh.audio.avgbytespersec) * 8 / 1000, &async, &range, comments); } catch (error_c error) { fprintf(stderr, "FATAL: ogm_reader: could not initialize MP3 " \ "packetizer for stream id %d. Will try to continue and " \ "ignore this stream.\n", numstreams); free(dmx); ogg_stream_clear(&new_oss); return; } dmx->stype = OGM_STREAM_TYPE_MP3; if (verbose) fprintf(stdout, "+-> Using MP3 output module for stream %d.\n", numstreams); break; case 0x2000: // AC3 try { dmx->packetizer = new ac3_packetizer_c(get_uint64(&sth.samples_per_unit), get_uint16(&sth.sh.audio.channels), get_uint32(&sth.sh.audio.avgbytespersec) * 8 / 1000, &async, &range, comments); } catch (error_c error) { fprintf(stderr, "FATAL: ogm_reader: could not initialize AC3 " \ "packetizer for stream id %d. Will try to continue and " \ "ignore this stream.\n", numstreams ); free(dmx); ogg_stream_clear(&new_oss); return; } dmx->stype = OGM_STREAM_TYPE_AC3; if (verbose) fprintf(stdout, "+-> Using AC3 output module for stream %d.\n", numstreams); break; default: fprintf(stderr, "FATAL: ogm_reader: Audio stream %d has a unknown " \ "type. Will try to continue and ignore this stream.\n", numstreams); free(dmx); ogg_stream_clear(&new_oss); return; break; } dmx->serial = ogg_page_serialno(og); memcpy(&dmx->os, &new_oss, sizeof(ogg_stream_state)); dmx->sid = nastreams; add_new_demuxer(dmx); return; } if (!strncmp(sth.streamtype, "text", 4)) { ntstreams++; numstreams++; if (!demuxing_requested(tstreams, ntstreams)) { ogg_stream_clear(&new_oss); return; } dmx = (ogm_demuxer_t *)malloc(sizeof(ogm_demuxer_t)); if (dmx == NULL) die("malloc"); memset(dmx, 0, sizeof(ogm_demuxer_t)); try { dmx->packetizer = new textsubs_packetizer_c(&async, &range, comments); } catch (error_c error) { fprintf(stderr, "FATAL: ogm_reader: could not initialize text " \ "subtitle packetizer for stream id %d. Will try to " \ "continue and ignore this stream.\n", numstreams); free(dmx); ogg_stream_clear(&new_oss); return; } dmx->stype = OGM_STREAM_TYPE_TEXT; dmx->serial = ogg_page_serialno(og); memcpy(&dmx->os, &new_oss, sizeof(ogg_stream_state)); dmx->sid = ntstreams; add_new_demuxer(dmx); if (verbose) fprintf(stdout, "+-> Using text subtitle output module for stream " "%d.\n", numstreams); return; } } /* * The old OggDS headers (see MPlayer's source, libmpdemux/demux_ogg.c) * are not supported. */ // Failed to detect a supported header. ogg_stream_clear(&new_oss); return; } /* * Process the contents of a page. First find the demuxer associated with * the page's serial number. If there is no such demuxer then either the * OGG file is damaged (very rare) or the page simply belongs to a stream * that the user didn't want extracted. * If the demuxer is found then hand over all packets in this page to the * associated packetizer. */ void ogm_reader_c::process_page(ogg_page *og) { ogm_demuxer_t *dmx; ogg_packet op; int hdrlen, eos, i; long lenbytes; dmx = find_demuxer(ogg_page_serialno(og)); if (dmx == NULL) return; ogg_stream_pagein(&dmx->os, og); while (ogg_stream_packetout(&dmx->os, &op) == 1) { hdrlen = (*op.packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*op.packet & PACKET_LEN_BITS2) << 1; if ((hdrlen > 0) && (op.bytes >= (hdrlen + 1))) for (i = 0, lenbytes = 0; i < hdrlen; i++) { lenbytes = lenbytes << 8; lenbytes += *((unsigned char *)op.packet + hdrlen - i); } eos = op.e_o_s; if (o_eos) op.e_o_s = 0; switch (dmx->stype) { case OGM_STREAM_TYPE_VORBIS: ((vorbis_packetizer_c *)dmx->packetizer)-> process(&op, ogg_page_granulepos(og)); break; case OGM_STREAM_TYPE_VIDEO: if ((*op.packet & 3) == PACKET_TYPE_COMMENT) { /* * Give the video packetizer the old comments if the user did not * provide comments via -c. */ if ((comments == NULL) || (comments[0] == NULL)) { vorbis_comment vc; if (vorbis_unpack_comment(&vc, (char *)op.packet, op.bytes) >= 0) dmx->packetizer->set_comments(&vc); } } else if ((*op.packet & 3) != PACKET_TYPE_HEADER) { ((video_packetizer_c *)dmx->packetizer)-> process((char *)&op.packet[hdrlen + 1], op.bytes - 1 - hdrlen, hdrlen > 0 ? lenbytes : 1, *op.packet & PACKET_IS_SYNCPOINT, op.e_o_s); dmx->units_processed += (hdrlen > 0 ? lenbytes : 1); } break; case OGM_STREAM_TYPE_PCM: if ((*op.packet & 3) == PACKET_TYPE_COMMENT) { /* * Give the video packetizer the old comments if the user did not * provide comments via -c. */ if ((comments == NULL) || (comments[0] == NULL)) { vorbis_comment vc; if (vorbis_unpack_comment(&vc, (char *)op.packet, op.bytes) >= 0) dmx->packetizer->set_comments(&vc); } } else if ((*op.packet & 3) != PACKET_TYPE_HEADER) { ((pcm_packetizer_c *)dmx->packetizer)-> process((char *)&op.packet[hdrlen + 1], op.bytes - 1 - hdrlen, op.e_o_s); dmx->units_processed += op.bytes - 1; } break; case OGM_STREAM_TYPE_MP3: // MP3 if ((*op.packet & 3) == PACKET_TYPE_COMMENT) { /* * Give the video packetizer the old comments if the user did not * provide comments via -c. */ if ((comments == NULL) || (comments[0] == NULL)) { vorbis_comment vc; if (vorbis_unpack_comment(&vc, (char *)op.packet, op.bytes) >= 0) dmx->packetizer->set_comments(&vc); } } else if ((*op.packet & 3) != PACKET_TYPE_HEADER) { ((mp3_packetizer_c *)dmx->packetizer)-> process((char *)&op.packet[hdrlen + 1], op.bytes - 1 - hdrlen, op.e_o_s); dmx->units_processed += op.bytes - 1; } break; case OGM_STREAM_TYPE_AC3: // AC3 if ((*op.packet & 3) == PACKET_TYPE_COMMENT) { /* * Give the video packetizer the old comments if the user did not * provide comments via -c. */ if ((comments == NULL) || (comments[0] == NULL)) { vorbis_comment vc; if (vorbis_unpack_comment(&vc, (char *)op.packet, op.bytes) >= 0) dmx->packetizer->set_comments(&vc); } } else if ((*op.packet & 3) != PACKET_TYPE_HEADER) { ((ac3_packetizer_c *)dmx->packetizer)-> process((char *)&op.packet[hdrlen + 1], op.bytes - 1 - hdrlen, op.e_o_s); dmx->units_processed += op.bytes - 1; } break; case OGM_STREAM_TYPE_TEXT: // text subtitles if ((*op.packet & 3) == PACKET_TYPE_COMMENT) { /* * Give the text packetizer the old comments if the user did not * provide comments via -c. */ if ((comments == NULL) || (comments[0] == NULL)) { vorbis_comment vc; if (vorbis_unpack_comment(&vc, (char *)op.packet, op.bytes) >= 0) dmx->packetizer->set_comments(&vc); } } else if ((*op.packet & 3) != PACKET_TYPE_HEADER) { char *subs = (char *)&op.packet[1 + hdrlen]; if ((*subs != 0) && (*subs != '\n') && (*subs != '\r') && strcmp(subs, " ")) { ((textsubs_packetizer_c *)dmx->packetizer)-> process(op.granulepos, op.granulepos + lenbytes, subs, op.e_o_s); dmx->units_processed++; } } break; } if (eos) { dmx->packetizer->flush_pages(); dmx->eos = 1; return; } } } /* * General reader. Before returning it MUST guarantee that each demuxer has * a page available OR that the corresponding stream is finished. */ int ogm_reader_c::read() { int done; ogm_demuxer_t *dmx; ogg_page og; if (pages_available() && !o_eos) return EMOREDATA; done = 0; while (!done) { // Make sure we have a page that we can work with. if (read_page(&og) == 0) return 0; // Is this the first page of a new stream? if (ogg_page_bos(&og)) continue; else // No, so process it normally. process_page(&og); done = 1; dmx = sdemuxers; if (dmx == NULL) // We haven't encountered a stream yet that we want to extract. done = 0; else do { if (!dmx->eos && !dmx->packetizer->page_available()) // This stream is not finished but has not yet produced a new page. done = 0; dmx = dmx->next; } while ((dmx != NULL) && done); } // Each known stream has now produced a new page or is at its end. dmx = sdemuxers; if (dmx == NULL) return EMOREDATA; // Are there streams that have not finished yet? do { if (!dmx->eos) return EMOREDATA; dmx = dmx->next; } while (dmx != NULL); // No, we're done with this file. return 0; } int ogm_reader_c::serial_in_use(int serial) { ogm_demuxer_t *demuxer; demuxer = sdemuxers; while (demuxer != NULL) { if (demuxer->packetizer->serial_in_use(serial)) return 1; demuxer = demuxer->next; } return 0; } ogmmerge_page_t *ogm_reader_c::get_header_page(int header_type) { ogmmerge_page_t *ompage = NULL; ogm_demuxer_t *demuxer; demuxer = sdemuxers; while (demuxer != NULL) { if (demuxer->packetizer != NULL) { ompage = demuxer->packetizer->get_header_page(header_type); if (ompage != NULL) return ompage; } demuxer = demuxer->next; } return NULL; } ogmmerge_page_t *ogm_reader_c::get_page() { generic_packetizer_c *winner; ogm_demuxer_t *demuxer; winner = NULL; demuxer = sdemuxers; while (demuxer != NULL) { if (winner == NULL) { if (demuxer->packetizer->page_available()) winner = demuxer->packetizer; } else if (winner->page_available() && (winner->get_smallest_timestamp() > demuxer->packetizer->get_smallest_timestamp())) winner = demuxer->packetizer; demuxer = demuxer->next; } if (winner != NULL) return winner->get_page(); else return NULL; } void ogm_reader_c::overwrite_eos(int no_eos) { o_eos = no_eos; } int ogm_reader_c::display_priority() { ogm_demuxer_t *dmx; dmx = sdemuxers; while (dmx != NULL) { if (dmx->stype == OGM_STREAM_TYPE_VIDEO) return DISPLAYPRIORITY_MEDIUM; dmx = dmx->next; } return DISPLAYPRIORITY_LOW; } static char wchar[] = "-\\|/-\\|/-"; void ogm_reader_c::display_progress() { ogm_demuxer_t *dmx; dmx = sdemuxers; while (dmx != NULL) { if (dmx->stype == OGM_STREAM_TYPE_VIDEO) { fprintf(stdout, "progress: %d frames\r", dmx->units_processed); fflush(stdout); return; } dmx = dmx->next; } fprintf(stdout, "working... %c\r", wchar[act_wchar]); act_wchar++; if (act_wchar == strlen(wchar)) act_wchar = 0; fflush(stdout); } generic_packetizer_c *ogm_reader_c::set_packetizer(generic_packetizer_c *np) { generic_packetizer_c *old; if (sdemuxers == NULL) return NULL; old = sdemuxers->packetizer; sdemuxers->packetizer = np; return old; } void ogm_reader_c::reset() { ogm_demuxer_t *dmx; dmx = sdemuxers; while (dmx != NULL) { dmx->packetizer->reset(); dmx = dmx->next; } } /* * Read all header pages. */ void ogm_reader_c::read_headers() { ogg_page og; while (1) { // Make sure we have a page that we can work with. if (read_page(&og) == 0) throw false; // Is this the first page of a new stream? if (ogg_page_bos(&og)) handle_new_stream(&og); else // No, so we're done reading the headers. break; } fseeko(file, 0, SEEK_SET); ogg_sync_clear(&oy); ogg_sync_init(&oy); } ogmtools-1.5/p_textsubs.h0000644000076400234220000000234507605371110015227 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_textsubs.h class definition for the text subtitle output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __P_TEXTSUBS_H__ #define __P_TEXTSUBS_H__ #include "ogmmerge.h" #include "queue.h" class textsubs_packetizer_c: public q_c { private: ogg_int64_t old_granulepos, last_granulepos; int packetno; audio_sync_t async; range_t range; int eos_packet_created; public: textsubs_packetizer_c(audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~textsubs_packetizer_c(); virtual int process(ogg_int64_t start, ogg_int64_t end, char *_subs, int last_sub); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); }; #endif /* __P_TEXTSUBS_H__*/ ogmtools-1.5/r_avi.h0000644000076400234220000000507710033036454014132 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_avi.h class definitions for the AVI demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_AVI_H__ #define __R_AVI_H__ #include #include extern "C" { #include } #include "ogmmerge.h" #include "queue.h" #include "p_video.h" #define RAVI_UNKNOWN 0 #define RAVI_DIVX3 1 #define RAVI_MPEG4 2 typedef struct avi_demuxer_t { generic_packetizer_c *packetizer; int channels, bits_per_sample, samples_per_second; int aid; int eos; ogg_int64_t bytes_processed; avi_demuxer_t *next; } avi_demuxer_t; class avi_reader_c: public generic_reader_c { private: char *chunk; avi_t *avi; video_packetizer_c *vpacketizer; avi_demuxer_t *ademuxers; double fps; int frames; unsigned char *astreams, *vstreams; char **comments; int max_frame_size; int act_wchar; audio_sync_t async; range_t range; char *old_chunk; int old_key, old_nread; int video_done, maxframes; int is_divx, rederive_keyframes; char *nav_seek; public: avi_reader_c(char *fname, unsigned char *astreams, unsigned char *vstreams, audio_sync_t *nasync, range_t *nrange, char **ncomments, char *nfourcc, char* nav_seek) throw (error_c); virtual ~avi_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); private: virtual int add_audio_demuxer(avi_t *avi, int aid); virtual int is_keyframe(unsigned char *data, long size, int suggestion); }; #endif /* __R_AVI_H__*/ ogmtools-1.5/config.guess0000644000076400234220000011330007535666440015204 0ustar mosuvj00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-05-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 c99 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i386-pc-interix3 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ogmtools-1.5/config.sub0000644000076400234220000007143307535666440014661 0ustar mosuvj00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-06-21' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa64 | mipsisa64el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipstx39 | mipstx39el \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3d) basic_machine=alpha-cray os=-unicos ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ogmtools-1.5/subtitles.cpp0000644000076400234220000000747010033327267015407 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes subtitles.cpp subtitle queueing and checking helper class Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include "ogmmerge.h" #include "subtitles.h" subtitles_c::subtitles_c() { first = NULL; last = NULL; } subtitles_c::~subtitles_c() { sub_t *current = first; while (current != NULL) { if (current->subs != NULL) free(current->subs); last = current; current = current->next; free(last); } } void subtitles_c::add(ogg_int64_t nstart, ogg_int64_t nend, char *nsubs) { sub_t *s; s = (sub_t *)malloc(sizeof(sub_t)); if (s == NULL) die("malloc"); s->subs = strdup(nsubs); s->start = nstart; s->end = nend; s->next = NULL; if (last == NULL) { first = s; last = s; } else { last->next = s; last = s; } } int subtitles_c::check() { sub_t *current; int error = 0; char *c; current = first; while ((current != NULL) && (current->next != NULL)) { if (current->end > current->next->start) { if (verbose) { char short_subs[21]; memset(short_subs, 0, 21); strncpy(short_subs, current->subs, 20); for (c = short_subs; *c != 0; c++) if (*c == '\n') *c = ' '; fprintf(stdout, "subtitles: Warning: current entry ends after " "the next one starts. This end: %02lld:%02lld:%02lld,%03lld" " next start: %02lld:%02lld:%02lld,%03lld (\"%s\"...)\n", current->end / (60 * 60 * 1000), (current->end / (60 * 1000)) % 60, (current->end / 1000) % 60, current->end % 1000, current->next->start / (60 * 60 * 1000), (current->next->start / (60 * 1000)) % 60, (current->next->start / 1000) % 60, current->next->start % 1000, short_subs); } current->end = current->next->start - 1; } current = current->next; } current = first; while (current != NULL) { if (current->start > current->end) { error = 1; if (verbose) { char short_subs[21]; memset(short_subs, 0, 21); strncpy(short_subs, current->subs, 20); for (c = short_subs; *c != 0; c++) if (*c == '\n') *c = ' '; fprintf(stdout, "subtitles: Warning: after fixing the time the " "current entry begins after it ends. This start: " "%02lld:%02lld:%02lld,%03lld this end: %02lld:%02lld:" "%02lld,%03lld (\"%s\"...)\n", current->start / (60 * 60 * 1000), (current->start / (60 * 1000)) % 60, (current->start / 1000) % 60, current->start % 1000, current->end / (60 * 60 * 1000), (current->end / (60 * 1000)) % 60, (current->end / 1000) % 60, current->end % 1000, short_subs); } } current = current->next; } return error; } void subtitles_c::process(textsubs_packetizer_c *p) { sub_t *current; while ((current = get_next()) != NULL) { p->process(current->start, current->end, current->subs, (first == NULL ? 1 : 0)); free(current->subs); free(current); } } sub_t *subtitles_c::get_next() { sub_t *current; if (first == NULL) return NULL; current = first; if (first == last) { first = NULL; last = NULL; } else first = first->next; return current; } ogmtools-1.5/ac3_common.c0000644000076400234220000000477410143367661015057 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes ac3common.c AC3 common functions Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include "ac3_common.h" int find_ac3_header(unsigned char *buf, int size, ac3_header_t *ac3_header) { static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640}; static unsigned char lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01}; static unsigned char halfrate[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; ac3_header_t header; int i; int frmsizecod; int bitrate; int half; int acmod; for (i = 0; i < (size - 7); i++) { if ((buf[i] != 0x0b) || (buf[i + 1] != 0x77)) continue; if (buf[i + 5] >= 0x60) continue; half = halfrate[buf[i + 5] >> 3]; acmod = buf[i + 6] >> 5; header.flags = ((((buf[i + 6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) | ((buf[i + 6] & lfeon[acmod]) ? A52_LFE : 0)); frmsizecod = buf[i + 4] & 63; if (frmsizecod >= 38) return -1; bitrate = rate[frmsizecod >> 1]; header.bit_rate = (bitrate * 1000) >> half; switch (buf[i + 4] & 0xc0) { case 0: header.sample_rate = 48000 >> half; header.bytes = 4 * bitrate; break; case 0x40: header.sample_rate = 44100 >> half; header.bytes = 2 * (320 * bitrate / 147 + (frmsizecod & 1)); break; case 0x80: header.sample_rate = 32000 >> half; header.bytes = 6 * bitrate; break; default: return -1; } switch(header.flags & A52_CHANNEL_MASK) { case A52_MONO: header.channels=1; break; case A52_CHANNEL: case A52_STEREO: case A52_CHANNEL1: case A52_CHANNEL2: case A52_DOLBY: header.channels=2; break; case A52_2F1R: case A52_3F: header.channels=3; break; case A52_3F1R: case A52_2F2R: header.channels=4; break; case A52_3F2R: header.channels=5; break; } if (header.flags & A52_LFE) header.channels++; memcpy(ac3_header, &header, sizeof(ac3_header_t)); return i; } return -1; } ogmtools-1.5/ac3_common.h0000644000076400234220000000172007541410404015040 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes ac3common.cpp AC3 header decoding functions Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __AC3COMMON_H #define __AC3COMMON_H #ifdef __cplusplus extern "C" { #endif #define A52_CHANNEL 0 #define A52_MONO 1 #define A52_STEREO 2 #define A52_3F 3 #define A52_2F1R 4 #define A52_3F1R 5 #define A52_2F2R 6 #define A52_3F2R 7 #define A52_CHANNEL1 8 #define A52_CHANNEL2 9 #define A52_DOLBY 10 #define A52_CHANNEL_MASK 15 #define A52_LFE 16 typedef struct { int sample_rate; int bit_rate; int channels; int flags; int bytes; } ac3_header_t; int find_ac3_header(unsigned char *buf, int size, ac3_header_t *ac3_header); #ifdef __cplusplus } #endif #endif ogmtools-1.5/p_mp3.h0000644000076400234220000000342707605371110014047 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_mp3.h class definition for the MP3 output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __P_MP3_H #define __P_MP3_H #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "mp3_common.h" class mp3_packetizer_c: public q_c { private: int bps, eos; u_int64_t bytes_output, packetno; unsigned long samples_per_sec; int channels; int mp3rate; char *tempbuf; audio_sync_t async; range_t range; ogg_int64_t old_granulepos; char *packet_buffer; int buffer_size; ogg_int64_t disk_fileno; public: mp3_packetizer_c(unsigned long nsamples_per_sec, int nchannels, int nmp3rate, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~mp3_packetizer_c(); virtual int process(char *buf, int size, int last_frame); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); private: virtual void add_to_buffer(char *buf, int size); virtual char *get_mp3_packet(unsigned long *header, mp3_header_t *mp3header); virtual int mp3_packet_available(); virtual void remove_mp3_packet(int pos, int framesize); }; #endif ogmtools-1.5/queue.cpp0000644000076400234220000001145510033327267014513 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes queue.cpp OGG page queueing class used by every packetizer Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include "ogmmerge.h" #include "queue.h" q_c::q_c() throw (error_c) : generic_packetizer_c() { first = NULL; current = NULL; next_is_key = -1; } q_c::~q_c() { q_page_t *qpage, *tmppage; qpage = first; while (qpage) { if (qpage->mpage != NULL) { if (qpage->mpage->og != NULL) { if (qpage->mpage->og->header != NULL) free(qpage->mpage->og->header); if (qpage->mpage->og->body != NULL) free(qpage->mpage->og->body); free(qpage->mpage->og); } free(qpage->mpage); } tmppage = qpage->next; free(qpage); qpage = tmppage; } } ogg_page *q_c::copy_ogg_page(ogg_page *src) { ogg_page *dst; if (src == NULL) die("internal error"); dst = (ogg_page *)malloc(sizeof(ogg_page)); if (dst == NULL) die("malloc"); if (src->header_len == 0) { fprintf(stderr, "FATAL: copy_ogg_page: src->header_len == 0.\n"); exit(1); } dst->header = (unsigned char *)malloc(src->header_len); if (dst->header == NULL) die("malloc"); dst->header_len = src->header_len; memcpy(dst->header, src->header, src->header_len); if (src->body_len != 0) { dst->body = (unsigned char *)malloc(src->body_len); if (dst->body == NULL) die("malloc"); dst->body_len = src->body_len; memcpy(dst->body, src->body, src->body_len); } else { dst->body = (unsigned char *)malloc(1); if (dst->body == NULL) die("malloc"); dst->body_len = 0; *(dst->body) = 0; } return dst; } int q_c::add_ogg_page(ogg_page *opage, int header_page, int index_serial = -1) { q_page_t *qpage; if (opage == NULL) return EOTHER; if ((opage->header == NULL) || (opage->body == NULL)) { fprintf(stderr, "Warning: add_ogg_page with empty header or body.\n"); return EOTHER; } qpage = (q_page_t *)malloc(sizeof(q_page_t)); if (qpage == NULL) die("malloc"); qpage->mpage = (ogmmerge_page_t *)malloc(sizeof(*qpage->mpage)); if (qpage->mpage == NULL) die("malloc"); qpage->mpage->og = q_c::copy_ogg_page(opage); qpage->mpage->timestamp = make_timestamp(ogg_page_granulepos(opage)); qpage->mpage->header_page = header_page; qpage->mpage->index_serial = index_serial; qpage->next = NULL; if (current != NULL) current->next = qpage; if (first == NULL) first = qpage; current = qpage; return 0; } int q_c::flush_pages(int header_page) { ogg_page page; while (ogg_stream_flush(&os, &page)) { add_ogg_page(&page, header_page, next_is_key); next_is_key = -1; } return 0; } int q_c::queue_pages(int header_page) { ogg_page page; while (ogg_stream_pageout(&os, &page)) { add_ogg_page(&page, header_page, next_is_key); next_is_key = -1; } return 0; } ogmmerge_page_t *q_c::get_page() { ogmmerge_page_t *mp; q_page_t *qpage; if (first && first->mpage) { mp = first->mpage; qpage = first->next; if (qpage == NULL) current = NULL; free(first); first = qpage; return mp; } return NULL; } ogmmerge_page_t *q_c::get_header_page(int header_type) { q_page_t *cur, *last; ogmmerge_page_t *omp; if (first == NULL) return NULL; last = NULL; cur = first; while (cur != NULL) { if (cur->mpage->header_page == header_type) break; last = cur; cur = cur->next; } if (cur == NULL) return NULL; omp = cur->mpage; if (!omp->header_page) return NULL; if (last != NULL) last->next = cur->next; else { if (current == first) current = first->next; first = first->next; } free(cur); return omp; } int q_c::page_available() { if ((first == NULL) || (first->mpage == NULL)) return 0; else return 1; } int q_c::header_page_available() { q_page_t *cur = first; while (cur) { if (cur->mpage && cur->mpage->header_page) return 1; cur = cur->next; } return 0; } stamp_t q_c::get_smallest_timestamp() { if (first != NULL) return first->mpage->timestamp; else return MAX_TIMESTAMP; } long q_c::get_queued_bytes() { long bytes; q_page_t *cur; bytes = 0; cur = first; while (cur != NULL) { if (cur->mpage != NULL) if (cur->mpage->og != NULL) bytes += cur->mpage->og->header_len + cur->mpage->og->body_len; cur = cur->next; } return bytes; } void q_c::next_page_contains_keyframe(int serial) { next_is_key = serial; } ogmtools-1.5/p_vobsub.h0000644000076400234220000000304207630171645014652 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_vobsub.h class definition for the VobSub subtitle output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifdef ENABLE_VOBSUB #ifndef __P_VOBSUB_H__ #define __P_VOBSUB_H__ #include "ogmmerge.h" #include "queue.h" typedef struct { int width, height; char *palette; int langidx; char *id; int index; } vobsub_stream_t; class vobsub_packetizer_c: public q_c { private: ogg_int64_t old_granulepos, last_granulepos; int packetno; audio_sync_t async; range_t range; int eos_packet_created; vobsub_stream_t params; public: vobsub_packetizer_c(int nwidth, int nheight, char *npalette, int nlangidx, char *nid, int nindex, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~vobsub_packetizer_c(); virtual int process(ogg_int64_t start, ogg_int64_t end, char *subs, int slen, int last_sub); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); }; #endif /* __P_VOBSUB_H__*/ #endif // ENABLE_VOBSUB ogmtools-1.5/r_mp3.h0000644000076400234220000000273207655160106014055 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_mp3.h class definitions for the MP3 demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_MP3_H__ #define __R_MP3_H__ #include #include extern "C" { #include } #include "ogmmerge.h" #include "queue.h" #include "p_mp3.h" class mp3_reader_c: public generic_reader_c { private: unsigned char *chunk; FILE *file; class mp3_packetizer_c *mp3packetizer; u_int64_t bytes_processed; off_t size; public: mp3_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~mp3_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); }; #endif /* __R_MP3_H__*/ ogmtools-1.5/INSTALL0000644000076400234220000001753010012132430013673 0ustar mosuvj00000000000000In addition to the general instructions below, you will need to install (or have installed) the ogg and vorbis libraries. Please see xiph.org or vorbis.com for information on obtaining those. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. ogmtools-1.5/ogmstreams.h0000644000076400234220000000656407757237160015235 0ustar mosuvj00000000000000#ifndef __OGGSTREAMS_H #define __OGGSTREAMS_H /* * Taken from http://tobias.everwicked.com/packfmt.htm * First packet (header) --------------------- pos | content | description -------+-------------------------+---------------------------------- 0x0000 | 0x01 | indicates 'header packet' -------+-------------------------+---------------------------------- 0x0001 | stream_header | the size is indicated in the | | size member Second packet (comment) ----------------------- pos | content | description -------+-------------------------+---------------------------------- 0x0000 | 0x03 | indicates 'comment packet' -------+-------------------------+---------------------------------- 0x0001 | data | see vorbis doc on www.xiph.org Data packets ------------ pos | content | description ---------+-------------------------+---------------------------------- 0x0000 | Bit0 0 | indicates data packet | Bit1 Bit 2 of lenbytes | | Bit2 unused | | Bit3 keyframe | | Bit4 unused | | Bit5 unused | | Bit6 Bit 0 of lenbytes | | Bit7 Bit 1 of lenbytes | ---------+-------------------------+---------------------------------- 0x0001 | LowByte | Length of this packet in samples | ... | (frames for video, samples for | HighByte | audio, 1ms units for text) ---------+-------------------------+---------------------------------- 0x0001+ | data | packet contents lenbytes | | * * */ //// OggDS headers // Header for the new header format typedef struct stream_header_video { ogg_int32_t width; ogg_int32_t height; } stream_header_video; typedef struct stream_header_audio { ogg_int16_t channels; ogg_int16_t blockalign; ogg_int32_t avgbytespersec; } stream_header_audio; typedef struct stream_header { char streamtype[8]; char subtype[4]; ogg_int32_t size; // size of the structure ogg_int64_t time_unit; // in reference time ogg_int64_t samples_per_unit; ogg_int32_t default_len; // in media time ogg_int32_t buffersize; ogg_int16_t bits_per_sample; union { // Video specific stream_header_video video; // Audio specific stream_header_audio audio; } sh; ogg_int16_t padding; } stream_header; typedef struct old_stream_header { char streamtype[8]; char subtype[4]; ogg_int32_t size; // size of the structure ogg_int64_t time_unit; // in reference time ogg_int64_t samples_per_unit; ogg_int32_t default_len; // in media time ogg_int32_t buffersize; ogg_int16_t bits_per_sample; ogg_int16_t padding; union { // Video specific stream_header_video video; // Audio specific stream_header_audio audio; } sh; } old_stream_header; /// Some defines from OggDS #define PACKET_TYPE_HEADER 0x01 #define PACKET_TYPE_COMMENT 0x03 #define PACKET_TYPE_BITS 0x07 #define PACKET_LEN_BITS01 0xc0 #define PACKET_LEN_BITS2 0x02 #define PACKET_IS_SYNCPOINT 0x08 #endif /* __OGGSTREAMS_H */ ogmtools-1.5/p_ac3.h0000644000076400234220000000362407605371110014015 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_ac3.h class definition for the AC3 output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __P_AC3_H #define __P_AC3_H #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "ac3_common.h" class ac3_packetizer_c: public q_c { private: int bps, eos; u_int64_t bytes_output, packetno; unsigned long samples_per_sec; int channels; int bitrate; char *tempbuf; audio_sync_t async; range_t range; ogg_int64_t old_granulepos; char *packet_buffer; int buffer_size; ogg_int64_t disk_fileno; public: ac3_packetizer_c(unsigned long nsamples_per_sec, int nchannels, int nbitrate, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~ac3_packetizer_c(); virtual int process(char *buf, int size, int last_frame); virtual stamp_t make_timestamp(ogg_int64_t granulepos); virtual void produce_eos_packet(); virtual void produce_header_packets(); virtual void reset(); virtual void set_params(unsigned long nsamples_per_sec, int nchannels, int nbitrate); private: virtual void add_to_buffer(char *buf, int size); virtual char *get_ac3_packet(unsigned long *header, ac3_header_t *ac3header); virtual int ac3_packet_available(); virtual void remove_ac3_packet(int pos, int framesize); }; #endif ogmtools-1.5/autogen.sh0000755000076400234220000000276407543560077014701 0ustar mosuvj00000000000000#!/bin/sh # Run this to set up the build system: configure, makefiles, etc. # (based on the version in enlightenment's cvs) package="ogmtools" olddir=`pwd` srcdir=`dirname $0` test -z "$srcdir" && srcdir=. cd "$srcdir" DIE=0 (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have autoconf installed to compile $package." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have automake installed to compile $package." echo "Download the appropriate package for your system, echo "or get the source from one of the GNU ftp sites" echo "listed in http://www.gnu.org/order/ftp.html" DIE=1 } 0 && (libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have libtool installed to compile $package." echo "Download the appropriate package for your system, echo "or get the source from one of the GNU ftp sites" echo "listed in http://www.gnu.org/order/ftp.html" DIE=1 } if test "$DIE" -eq 1; then exit 1 fi echo "Generating configuration files for $package, please wait...." echo " aclocal $ACLOCAL_FLAGS" && aclocal $ACLOCAL_FLAGS #echo " autoheader" && autoheader #echo " libtoolize --automake" && libtoolize --automake echo " autoconf" && autoconf echo " automake --add-missing --copy" && automake --add-missing --copy cd $olddir ogmtools-1.5/r_ac3.h0000644000076400234220000000263307655160106014024 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_ac3.cpp AC3 demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_AC3_H #define __R_AC3_H #include #include #include "ogmmerge.h" #include "queue.h" #include "p_ac3.h" #include "ac3_common.h" class ac3_reader_c: public generic_reader_c { private: unsigned char *chunk; FILE *file; class ac3_packetizer_c *ac3packetizer; u_int64_t bytes_processed; off_t size; public: ac3_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~ac3_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); }; #endif ogmtools-1.5/r_microdvd.h0000644000076400234220000000271407655160106015165 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_microdvd.h class definitions for the MicroDVD text subtitle reader Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __R_MICRODVD_H__ #define __R_MICRODVD_H__ #include #include #include "ogmmerge.h" #include "queue.h" #include "p_textsubs.h" class microdvd_reader_c: public generic_reader_c { private: char chunk[2048]; FILE *file; textsubs_packetizer_c *textsubspacketizer; int act_wchar; public: microdvd_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c); virtual ~microdvd_reader_c(); virtual int read(); virtual int serial_in_use(int); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual void reset(); virtual int display_priority(); virtual void display_progress(); static int probe_file(FILE *file, off_t size); }; #endif /* __R_MICRODVD_H__*/ ogmtools-1.5/dvdxchap.c0000644000076400234220000001531610143370275014627 0ustar mosuvj00000000000000/* dvdxchap -- utility for extracting chapter start times from IFO files Written by Moritz Bunkus Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include #include #include void usage() { fprintf(stdout, "ogmtools v" VERSION "\n" "Usage: dvdxchap [options] DVD-SOURCE\n\n" " options:\n" " -t, --title num Use title 'num'. Default is 1.\n" " -c, --chapter start[-end] Chapter to start at (to end at). Default 1.\n" " -v, --verbose Increase verbosity\n" " -V, --version Show version information\n" " -h, --help Show this help\n"); } void display_chapters(char *source, int title, int start, int end, int verbose) { dvd_reader_t *dvd; ifo_handle_t *vmg; ifo_handle_t *vts; tt_srpt_t *tt_srpt; int ttn, pgn, pgc_id, start_cell, end_cell, i, j; vts_ptt_srpt_t *vts_ptt_srpt; pgc_t *cur_pgc; dvd_time_t *dt; double fps; long hour, minute, second, ms, overall_time, start_time, cur_time; dvd = DVDOpen(source); if (dvd == NULL) { fprintf(stderr, "(%s) Could not open source '%s'.\n", __FILE__, source); exit(1); } vmg = ifoOpen(dvd, 0); if (vmg == NULL) { fprintf(stderr, "(%s) Can't open VMG info.\n", __FILE__); DVDClose(dvd); exit(1); } tt_srpt = vmg->tt_srpt; if (verbose) fprintf(stderr, "(%s) This DVD contains %d titles.\n", __FILE__, tt_srpt->nr_of_srpts); if (title > tt_srpt->nr_of_srpts) { fprintf(stderr, "(%s) The DVD only contains %d titles.\n", __FILE__, tt_srpt->nr_of_srpts); ifoClose(vmg); DVDClose(dvd); exit(1); } title--; if (verbose) fprintf(stderr, "(%s) Title %d contains %d chapters.\n", __FILE__, title + 1, tt_srpt->title[title].nr_of_ptts); vts = ifoOpen(dvd, tt_srpt->title[title].title_set_nr); if (vts == NULL) { fprintf(stderr, "(%s) Can't open VTS info.\n", __FILE__); ifoClose(vmg); DVDClose(dvd); exit(1); } if (end > 0) { if ((end <= start) || (end > tt_srpt->title[title].nr_of_ptts)) { fprintf(stderr, "(%s) Invalid end chapter.\n", __FILE__); ifoClose(vmg); DVDClose(dvd); exit(1); } } ttn = tt_srpt->title[title].vts_ttn; vts_ptt_srpt = vts->vts_ptt_srpt; start_time = overall_time = 0; for (i = 0; i < tt_srpt->title[title].nr_of_ptts - 1; i++) { pgc_id = vts_ptt_srpt->title[ttn - 1].ptt[i].pgcn; pgn = vts_ptt_srpt->title[ttn - 1].ptt[i].pgn; cur_pgc = vts->vts_pgcit->pgci_srp[pgc_id - 1].pgc; start_cell = cur_pgc->program_map[pgn - 1] - 1; pgc_id = vts_ptt_srpt->title[ttn - 1].ptt[i + 1].pgcn; pgn = vts_ptt_srpt->title[ttn - 1].ptt[i + 1].pgn; cur_pgc = vts->vts_pgcit->pgci_srp[pgc_id - 1].pgc; end_cell = cur_pgc->program_map[pgn - 1] - 2; cur_time = 0; for (j = start_cell; j <= end_cell; j++) { dt = &cur_pgc->cell_playback[j].playback_time; hour = ((dt->hour & 0xf0) >> 4) * 10 + (dt->hour & 0x0f); minute = ((dt->minute & 0xf0) >> 4) * 10 + (dt->minute & 0x0f); second = ((dt->second & 0xf0) >> 4) * 10 + (dt->second & 0x0f); if (((dt->frame_u & 0xc0) >> 6) == 1) fps = 25.00; else fps = 29.97; dt->frame_u &= 0x3f; dt->frame_u = ((dt->frame_u & 0xf0) >> 4) * 10 + (dt->frame_u & 0x0f); ms = (double)dt->frame_u * 1000.0 / fps; cur_time += (hour * 60 * 60 * 1000 + minute * 60 * 1000 + second * 1000 + ms); } if (start == i) start_time = overall_time; if (i >= start && (i < end || end <= 0)) { fprintf(stdout, "CHAPTER%02d=%02ld:%02ld:%02ld.%03ld\n", i + 1 - start, (overall_time - start_time) / 60 / 60 / 1000, ((overall_time - start_time) / 60 / 1000) % 60, ((overall_time - start_time) / 1000) % 60, (overall_time - start_time) % 1000); fprintf(stdout, "CHAPTER%02dNAME=Chapter %02d\n", i + 1 - start, i + 1 - start); } overall_time += cur_time; } if (end <= 0 || i == end) { fprintf(stdout, "CHAPTER%02d=%02ld:%02ld:%02ld.%03ld\n", i + 1 - start, (overall_time - start_time) / 60 / 60 / 1000, ((overall_time - start_time) / 60 / 1000) % 60, ((overall_time - start_time) / 1000) % 60, (overall_time - start_time) % 1000); fprintf(stdout, "CHAPTER%02dNAME=Chapter %02d\n", i + 1 - start, i + 1 - start); } ifoClose(vts); ifoClose(vmg); DVDClose(dvd); } int main(int argc, char *argv[]) { int title = 1; int start = 0, end = 0; int i; char *source = NULL; int verbose = 0; if (argc == 1) { usage(); exit(0); } for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { usage(); exit(0); } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) verbose++; else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { fprintf(stdout, "dvdxchap v" VERSION "\n"); exit(0); } else if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--title")) { if ((i + 1) >= argc) { fprintf(stderr, "(%s) Error: -t lacks a title number.\n", __FILE__); exit(1); } title = strtol(argv[i + 1], NULL, 10); if ((errno == ERANGE) || (errno == EINVAL) || (title < 1)) { fprintf(stderr, "(%s) Error: '%s' is not a valid title number.\n", __FILE__, argv[i + 1]); exit(1); } i++; } else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--chapter")) { if ((i + 1) >= argc) { fprintf(stderr, "(%s) Error: -c lacks a chapter number.\n", __FILE__); exit(1); } if (sscanf(argv[i + 1], "%d-%d", &start, &end) < 1) { fprintf(stderr, "(%s) Error: '%s' is not a valid chapter range.\n", __FILE__, argv[i + 1]); exit(1); } if (start < 0) { end = -start; start = 0; } if ((start > end) && (end > 0)) { int tmp; tmp = start; start = end; end = tmp; } if (start > 0) start--; i++; } else { if (source != NULL) { fprintf(stderr, "(%s) Error: more than one source given.\n", __FILE__); exit(1); } source = argv[i]; } } if (source == NULL) { fprintf(stderr, "(%s) Error: No source given.\n", __FILE__); exit(1); } display_chapters(source, title, start, end, verbose); return 0; } ogmtools-1.5/ogmtools.spec0000644000076400234220000000375310143371176015404 0ustar mosuvj00000000000000Summary: Tools for Ogg media streams Name: ogmtools Version: 1.5 Release: 1 Source0: ogmtools-%{version}.tar.bz2 License: GPL Group: Sound/Tools BuildRoot: %{_tmppath}/%{name}-buildroot URL: http://www.bunkus.org/videotools/ogmtools/ %description These tools allow information about (ogminfo) or extraction from (ogmdemux) or creation of (ogmmerge) or the splitting of (ogmsplit) OGG media streams. OGM is used for "OGG media streams". %prep rm -rf $RPM_BUILD_ROOT %setup -q ./autogen.sh %configure --prefix=%{_prefix} make %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,man/man1} make DESTDIR=$RPM_BUILD_ROOT install %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %_bindir/* %_mandir/man1/* %doc README INSTALL ChangeLog TODO COPYING %changelog * Sun Nov 07 2004 Moritz Bunkus 1.5-1 - new upstream * Tue Aug 03 2004 Moritz Bunkus 1.4.1-1 - new upstream * Mon Apr 14 2004 Moritz Bunkus 1.4-1 - new upstream * Mon Apr 05 2004 Moritz Bunkus 1.3-1 - new upstream * Thu Nov 20 2003 Moritz Bunkus 1.2-1 - new upstream * Tue Oct 27 2003 Moritz Bunkus 1.1-1 - new upstream * Tue May 20 2003 Moritz Bunkus 1.0.3-1 - new upstream * Mon May 06 2003 Moritz Bunkus 1.0.2-1 - new upstream * Tue Mar 04 2003 Moritz Bunkus 1.0.1-1 - new upstream * Sat Mar 01 2003 Moritz Bunkus 1.0.0-1 - new upstream * Fri Jan 03 2003 Moritz Bunkus 0.973-1 - new upstream * Fri Dec 13 2002 Moritz Bunkus 0.970-1 - new upstream * Fri Nov 13 2002 Moritz Bunkus 0.960-1 - new upstream * Tue Oct 01 2002 Moritz Bunkus 0.951-1 - new upstream * Sun Sep 22 2002 Moritz Bunkus 0.950-1 - changes to the description and version number * Sun Sep 22 2002 Marc Lavallée 0.931-1 - initial spac file ogmtools-1.5/README0000644000076400234220000000515310143371176013541 0ustar mosuvj00000000000000OGMtools 1.5 ============== --[ IMPORTANT ] --------------------------------------------------- Up to version 1.2 ogmmerge produced broken headers. Version 1.2 is now able to read both the old headers and the proper new ones and will only write proper headers. In order to fix the broken headers in old files you can simply run something like: ogmmerge -o good.ogm old_and_broken.ogm --[ IMPORTANT ] --------------------------------------------------- These tools allow information about (ogminfo) or extraction from (ogmdemux) or creation of (ogmmerge) or the splitting of (ogmsplit) OGG media streams. OGM is used for "OGG media streams". Base code taken from Ogg/Vorbis CVS repository at http://www.xiph.org/ Installation is simple. Run './configure' followed by 'make' and 'make install'. If, for some reason, there is no 'configure' script then run './autogen.sh' which will recreate it. The full documentation for each command is now maintained in its man page only. Type 'ogmmerge -h' to get you started. This code comes under the GPL (see www.gnu.org or the file COPYING). Modify as needed. The newest version can always be found at http://www.bunkus.org/videotools/ogmtools/index.html Moritz Bunkus ------------------ Example ======= Here's a *very* brief example of how you could use the ogmtools with mencoder in order to rip a DVD: a) Extract the audio to PCM audio and let mencoder calculate the video frame numbers: mencoder -dvd 1 -ovc frameno -oac pcm -o frameno.avi b) Extract the audio again, this time to a plain WAV file: mplayer -dvd 1 -vc dummy -vo null -hardframedrop -ao pcm -aofile audio.wav At the moment selecting a non-existant video codec with -vc results in the fastest audio dump. c) Normalize the sound (optional) normalize audio.wav d) Encode the audio to Vorbis: oggenc -q3 -oaudio-q3.ogg audio.wav e) Somehow calculate the bitrate for your video. Use something like... video_size = (target_size - audio-size) / 1.0115 video_bitrate = video_size / length / 1000 * 8 target_size, audio_size in bytes length in seconds 1.0115 is the overhead caused by putting the streams into an OGM file. video_bitrate will be in kbit/s f) Use the two-pass encoding for the video: mencoder -dvd 1 -oac copy -ovc lavc \ -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:vpass=1 \ -vop scale=....,crop=..... \ -o /dev/null mencoder -dvd 1 -oac copy -ovc lavc \ -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:vpass=2 \ -vop scale=....,crop=..... \ -o movie.avi g) Merge: ogmmerge -o movie.ogm -A movie.avi audio-q3.ogg The option -A should be given to avoid copying the raw PCM audio stream. ogmtools-1.5/ogmsplit.10000644000076400234220000001016210143371176014575 0ustar mosuvj00000000000000.TH OGMSPLIT "1" "November 2004" "ogmsplit v1.5" "User Commands" .SH NAME ogmsplit \- Split OGG/OGM files into sevaral smaller OGG/OGM files .SH SYNOPSIS .B ogmsplit [\fIoptions\fR] \fIinname\fR .SH DESCRIPTION .LP \fBogmsplit\fP can be used to easily split an OGM file after a given size. Several OGM files will be created that each start with a keyframe. .TP inname Use '\fIinname\fR' as the source. .TP \fB\-o\fR, \fB\-\-output\fR \fIout\fR Use '\fIout\fR' as the base name. Ascending part numbers will be appended to it. Default is '\fIinname\fR'. Examples: .br 1) If \fB\-o\fR \fIoutput.ogg\fR is given on the command line then \fBogmsplit\fR will create \fIoutput\-000001.ogg\fR, \fIoutput\-000002.ogg\fR and so on. .br 2) If no \fB\-o\fR option is given and the input's name is \fImovie.ogm\fR then \fBogmsplit\fR will create \fImovie-000001.ogm\fR and so on. .LP The operation mode can be set with exactly one of \fB\-s\fR, \fB\-t,\fR \fB\-c\fR or \fB\-p\fR. The default mode is to split by size (\fB\-s\fR). .TP \fB\-s\fR, \fB\-\-size\fR \fIsize\fR Size in MiB ( = 1024 * 1024 bytes) after which a new file will be opened (approximately). Default is 700MiB. Size can end in 'B' to indicate 'bytes' instead of 'MiB'. .TP \fB\-t\fR, \fB\-\-time\fR \fItime\fR Split after the given elapsed time (approximately). \&'\fItime\fR' takes the form \fIHH:MM:SS.sss\fR or simply \fISS\fR(.\fIsss\fR), e.g. 00:05:00.000 or 300.000 or simply 300. .TP \fB\-c\fR, \fB--cuts\fR \fIcuts\fR Produce output files as specified by \fIcuts\fR, a list of slices of the form "\fIstart\fR\-\fIend\fR" or "\fIstart\fR+\fIlength\fR", separated by commas. If \fIstart\fR is omitted, it defaults to the end of the previous cut. \fIstart\fR and \fIend\fR take the same format as the arguments to \fB\-t\fR. .TP \fB\-n\fR, \fB\-\-num\fR \fInum\fR Don't create more than \fInum\fR separate files. The last one may be bigger than the desired size. Default is an unlimited number of files. Can only be used with \fB-s\fR or \fB-t\fR. .TP \fB\-\-frontend\fR Frontend mode. Progress output will be terminated by \\n instead of \\r. .TP \fB\-p\fR, \fB\-\-print-splitpoints\fR Only print the key frames and the number of bytes encountered before each. Useful to find the exact splitting point. .TP \fB\-v\fR, \fB\-\-verbose\fR Be verbose and show each OGG packet. Can be used twice to increase verbosity. .TP \fB\-h\fR, \fB\-\-help\fR Show this help. .TP \fB\-V\fR, \fB\-\-version\fR Show version information. .SH CHAPTER INFORMATION \fBogmsplit\fR correctly handles chapter information. During the first pass the chapter information, if any is present, will be adjusted to match the output files generated. Chapters that are not contained in the current output file are removed entirely. The other chapters are renumbered to start at 1, and their timestamps will be recalculated. .br Example: If your source file contains these four chapters: .LP CHAPTER01=00:00:00.000 .br CHAPTER01NAME=Chapter 01 .br CHAPTER02=00:10:00.000 .br CHAPTER02NAME=Chapter 02 .br CHAPTER03=00:20:00.000 .br CHAPTER03NAME=Chapter 03 .br CHAPTER04=00:25:00.000 .br CHAPTER04NAME=Chapter 04 .LP and you split after 15 minutes, then the first output file will only contain the first two chapters as shown above, and the second output file will contain the following two chapters and the remaining part of the first: .LP CHAPTER01=00:00:00.000 .br CHAPTER01NAME=Chapter 02 (continued) .br CHAPTER02=00:05:00.000 .br CHAPTER02NAME=Chapter 03 .br CHAPTER03=00:10:00.000 .br CHAPTER03NAME=Chapter 04 .LP Note that only variable names are changed, not the chapter names themselves. The exception is the first chapter of the second and following files where "(continued)" is appended in order to indicate that this is not the start of this chapter. If you want to change them as well you'll have to remerge the resulting file with a new chapter file. .SH AUTHOR .I ogmsplit was written by Moritz Bunkus . .SH SEE ALSO .BR ogmmerge (1), .BR ogminfo (1), .BR ogmdemux (1), .BR ogmcat (1), .BR dvdxchap (1) .SH WWW The newest version can always be found at .UR http://www.bunkus.org/videotools/ogmtools/ .UE ogmtools-1.5/p_vobsub.cpp0000644000076400234220000001520107655160106015202 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes p_textsubs.cpp text subtitle output module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "queue.h" #include "ogmstreams.h" #include "p_vobsub.h" #include "vorbis_header_utils.h" #ifdef ENABLE_VOBSUB vobsub_packetizer_c::vobsub_packetizer_c(int nwidth, int nheight, char *npalette, int nlangidx, char *nid, int nindex, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) : q_c() { char buffer[50]; serialno = create_unique_serial(); ogg_stream_init(&os, serialno); packetno = 0; memcpy(&async, nasync, sizeof(audio_sync_t)); memcpy(&range, nrange, sizeof(range_t)); range.start *= 1000; range.end *= 1000; eos_packet_created = 0; params.width = nwidth; params.height = nheight; params.palette = strdup(npalette); if (params.palette == NULL) die("strdup"); params.langidx = nlangidx; params.id = strdup(nid); if (params.id == NULL) die("strdup"); params.index = nindex; comments = generate_vorbis_comment(ncomments); vorbis_comment_remove_tag(comments, "ID"); vorbis_comment_remove_tag(comments, "INDEX"); vorbis_comment_remove_tag(comments, "LANGIDX"); vorbis_comment_remove_tag(comments, "PALETTE"); vorbis_comment_add_tag(comments, "ID", params.id); buffer[49] = 0; snprintf(buffer, 49, "%d", params.index); vorbis_comment_add_tag(comments, "INDEX", buffer); snprintf(buffer, 49, "%d", params.langidx); vorbis_comment_add_tag(comments, "LANGIDX", buffer); vorbis_comment_add_tag(comments, "PALETTE", params.palette); old_granulepos = 0; last_granulepos = 0; } vobsub_packetizer_c::~vobsub_packetizer_c() { ogg_stream_clear(&os); if (comments != NULL) { vorbis_comment_clear(comments); free(comments); } } void vobsub_packetizer_c::produce_header_packets() { ogg_packet op; stream_header sh; int clen, res; char *tempbuf; memset(&sh, 0, sizeof(sh)); strcpy(sh.streamtype, "image"); strncpy(sh.subtype, "VBSB", 4); put_uint32(&sh.size, sizeof(sh)); put_uint64(&sh.time_unit, 10000); put_uint64(&sh.samples_per_unit, 1); put_uint32(&sh.default_len, 1); put_uint32(&sh.buffersize, 16384); tempbuf = (char *)malloc(sizeof(sh) + 1); if (tempbuf == NULL) die("malloc"); *tempbuf = PACKET_TYPE_HEADER; memcpy(&tempbuf[1], &sh, sizeof(sh)); op.packet = (unsigned char *)tempbuf; op.bytes = 1 + get_uint32(&sh.size); op.b_o_s = 1; op.e_o_s = 0; op.packetno = 0; op.granulepos = 0; /* submit it */ ogg_stream_packetin(&os, &op); packetno++; flush_pages(PACKET_TYPE_HEADER); free(tempbuf); /* Create the comments packet */ clen = -1 * comments_to_buffer(comments, NULL, 0); tempbuf = (char *)malloc(clen); if (tempbuf == NULL) die("malloc"); op.packet = (unsigned char *)tempbuf; op.bytes = clen; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; op.packetno = 1; if ((res = comments_to_buffer(comments, (char *)op.packet, clen)) < 0) { fprintf(stderr, "FATAL: p_vobsub: comments_to_buffer returned %d, " \ "clen is %d\n", res, clen); exit(1); } ogg_stream_packetin(&os, &op); flush_pages(PACKET_TYPE_COMMENT); packetno++; free(tempbuf); last_granulepos = 0; } void vobsub_packetizer_c::reset() { } int vobsub_packetizer_c::process(ogg_int64_t start, ogg_int64_t end, char *subs, int slen, int last_sub) { ogg_packet op; char *tempbuf; int clen, idx, i; unsigned char *bptr; if (packetno == 0) produce_header_packets(); if (eos_packet_created) return 0; // Adjust the start and end values according to the audio adjustment. start += async.displacement; start = (ogg_int64_t)(async.linear * start); end += async.displacement; end = (ogg_int64_t)(async.linear * end); /* * Now adjust and check the range. If the end is < 0 then it is definitely * too early. */ start -= (ogg_int64_t)range.start; end -= (ogg_int64_t)range.start; if (end < 0) { if (last_sub) { produce_eos_packet(); return 0; } else return EMOREDATA; } // If the start is > the range end the packet is too late. if ((range.end > 0) && (start > (range.end - range.start))) { if (last_sub || !eos_packet_created) { produce_eos_packet(); return 0; } else return EMOREDATA; } // At least part of the subtitle packet must be shown. if (start < 0) start = 0; if ((range.end > 0) && (end > (range.end - range.start))) end = (ogg_int64_t)(range.end - range.start); clen = end - start; for (i = 3; i >= 0; i--) if (clen > (1 << (8 * i))) break; i++; idx = strlen(subs) - 1; while ((idx >= 0) && ((subs[idx] == '\n') || (subs[idx] == '\r'))) { subs[idx] = 0; idx--; } subs[idx + 1] = 0x0d; subs[idx + 2] = 0; tempbuf = (char *)malloc(slen + i + 1); memcpy((char *)&tempbuf[i + 1], subs, slen); tempbuf[0] = (((i & 3) << 6) + ((i & 4) >> 1)) | PACKET_IS_SYNCPOINT; bptr = (unsigned char *)&tempbuf[1]; for (idx = 0; idx < i; idx++) { *(bptr + idx) = (unsigned char)(clen & 0xFF); clen >>= 8; } op.packet = (unsigned char *)tempbuf; op.bytes = slen + i + 1; op.b_o_s = 0; op.e_o_s = last_sub; op.granulepos = start; op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); free(tempbuf); last_granulepos = end; free(subs); return EMOREDATA; } void vobsub_packetizer_c::produce_eos_packet() { ogg_packet op; char tempbuf[4]; tempbuf[0] = (1 << 6) | PACKET_IS_SYNCPOINT; tempbuf[1] = (char)1; tempbuf[2] = ' '; tempbuf[3] = 0; op.packet = (unsigned char *)tempbuf; op.bytes = 4; op.b_o_s = 0; op.e_o_s = 1; op.granulepos = last_granulepos; op.packetno = packetno++; ogg_stream_packetin(&os, &op); flush_pages(); eos_packet_created = 1; } stamp_t vobsub_packetizer_c::make_timestamp(ogg_int64_t granulepos) { stamp_t stamp; #ifndef XIPHCORRECTINTERLEAVING stamp = granulepos * 1000; #else stamp = old_granulepos * 1000; #endif old_granulepos = granulepos; return stamp; } #endif // ENABLE_VOBSUB ogmtools-1.5/ogmmerge.10000644000076400234220000003032710143371176014546 0ustar mosuvj00000000000000.TH OGMMERGE "1" "November 2004" "ogmmerge v1.5" "User Commands" .SH NAME ogmmerge \- Merge multimedia streams into an OGG/OGM file .SH SYNOPSIS .B ogmmerge [\fIglobal options\fR] \-o \fIout\fR [\fIoptions\fR] [[\fIoptions\fR] ...] .SH DESCRIPTION .LP This program takes the input from several media files and joins their streams (all of them or just a selection) into an OGM. It was formerly known as 'oggmerge' and is based on the 'oggmerge' CVS module from Xiph's repository .UR http://www.xiph.org/ (). .UE .LP Global options: .TP \fB\-v\fR, \fB\-\-verbose\fR Increase verbosity. .TP \fB\-q\fR, \fB\-\-quiet\fR Suppress status output. .TP \fB\-o\fR, \fB\-\-output\fR \fIout\fR Write to the file '\fIout\fR'. .LP Options that can be used for each input file: .TP \fB\-a\fR, \fB\-\-astreams\fR <\fIn\fR,\fIm\fR,...> Copy the \fIn\fR'th audio stream, NOT the stream with the serial no. \fIn\fR. Default: copy all audio streams. .TP \fB\-d\fR, \fB\-\-vstreams\fR <\fIn\fR,\fIm\fR,...> Copy the \fIn\fR'th video stream, NOT the stream with the serial no. \fIn\fR. Default: copy all video streams. .TP \fB\-t\fR, \fB\-\-tstreams\fR <\fIn\fR,\fIm\fR,...> Copy the \fIn\fR'th text stream, NOT the stream with the serial no. \fIn\fR. Default: copy all text streams. .TP \fB\-A\fR, \fB\-\-noaudio\fR Don't copy any audio stream from this file. .TP \fB\-D\fR, \fB\-\-novideo\fR Don't copy any video stream from this file. .TP \fB\-T\fR, \fB\-\-notext\fR Don't copy any text stream from this file. .TP \fB\-s\fR, \fB\-\-sync\fR <\fId\fR[,\fIo\fR[/\fIp\fR]]> Synchronize manually, delay the audio stream by \fId\fR ms. .br \fId\fR > 0: Pad with silent samples. .br \fId\fR < 0: Remove samples from the beginning. .br \fIo\fR/\fIp\fR: adjust the timestamps by \fIo\fR/\fIp\fR to fix linear drifts. \fIp\fR defaults to 1000 if omitted. Both \fIo\fR and \fIp\fR can be floating point numbers. .br Defaults: no manual synch correction (which is the same as \fId\fR = 0 and \fIo\fR/\fIp\fR = 1.0). .TP \fB\-r\fR, \fB\-\-range\fR <\fIstart\fR-\fIend\fR> Only process from \fIstart\fR to \fIend\fR. Both values take the form '\fIHH:MM:SS.mmm\fR' or '\fISS.mmm\fR', e.g. '00:01:00.500' or '60.500'. If one of \fIstart\fR or \fIend\fR is omitted then it defaults to 0 or to end of the file respectively. .br If you want to split a file into smaller ones I strongly suggest you use \fBogmsplit(1)\fR as it can do a much better job than using the \fB-r\fR option. .TP \fB\-c\fR, \fB\-\-comment\fR '\fIA=B#C=D\fR' or '\fI@filename\fR' Set additional comment fields for the streams. Sensitive values would be \&'\fILANGUAGE=English\fR' or '\fITITLE=Ally McBeal\fR'. If the parameter starts with '@' then the comments will be read from a file with the same name without the leading '@'. \fB\-c\fR can be specified multiple times per file. The comments will all be concatenated. .TP \fB\-f\fR, \fB\-\-fourcc\fR <\fIFourCC\fR> Forces the FourCC to the specified value. Works only for video streams. Note that you cannot simply use a hex editor and change the FourCC by hand as the OGG file format uses checksums which would be wrong after such a change. .TP \fB\-\-omit\-empty\-packets\fR Normally, when a subtitle entry should be removed, an empty packet is created and inserted with the appropriate timestamp. With this option these empty packets are omitted completely. .TP \fB\-\-old\-headers\fR Assume that the input file has been created with an older version of \fBogmmerge\fR ( < 1.1). This may be needed if \fRogmmerge\fR cannot read such a file correctly. .TP \fB\-\-nav\-seek\fR <\fIfilename\fR> Use an external AVI index file as generated by \fBaviindex\fR from the transcode package. Can be used if an AVI file has a broken index. .LP Other options: .TP \fB\-l\fR, \fB\-\-list\-types\fR List supported input file types. .TP \fB\-h\fR, \fB\-\-help\fR Show usage information. .TP \fB\-V\fR, \fB\-\-version\fR Show version information. .SH USAGE .LP For each file the user can select which tracks \fBogmmerge\fR should take. They are all put into the file specified with '-o'. A list of known (and supported) source formats can be obtained with the '-l' option. .SH EXAMPLES .LP Let's assume you have a file called \fIMyMovie.avi\fP and the audio track in a separate file, e.g. \fIMyMovie.wav\fP. First you want to encode the audio to OGG: .LP $ \fBoggenc -q4 -oMyMovie.ogg MyMovie.wav\fP .LP After a couple of minutes you can join video and audio: .LP $ \fBogmmerge -o MyMovie-with-sound.ogm MyMovie.avi MyMovie.ogg\fP .LP If your AVI already contains an audio track then it will be copied aswell (if \fBogmmerge\fR supports the audio format). To avoid that simply do .LP $ \fBogmmerge -o MyMovie-with-sound.ogm -A MyMovie.avi MyMovie.ogg\fP .LP After some minutes of consideration you rip another audio track, e.g. the director's comments or another language to \fIMyMovie-add-audio.wav\fP. Encode it again and join it up with the other file: .LP $ \fBoggenc -q4 -oMyMovie-add-audio.ogg MyMovie-add-audio.wav\fP .br $ \fBogmmerge -o MM-complete.ogm MyMovie-with-sound.ogm MyMovie-add-audio.ogg\fP .LP The same result can be achieved with .LP $ \fBogmmerge -o MM-complete.ogm -A MyMovie.avi MyMovie.ogg \\\fP .br \fBMyMovie-add-audio.ogg\fP .LP Now fire up mplayer and enjoy. If you have multiple audio tracks (or even video tracks) then you can tell mplayer which track to play with the \&'\fB-vid\fP' and '\fB-aid\fP' parameters. These are 0-based and do not distinguish between video and audio. .LP If you need an audio track synchronized you can do that easily with .LP $ \fBogmmerge -o goodsync.ogm -A source.avi -s 200 outofsync.ogg\fP .LP This would add 200ms of silence at the beginning of the audio tracks taken from \fIoutofsync.ogg\fP. And \fB-s\fP always applies to all audio tracks in a source file. If you want to apply \fB-s\fP only to a specific track then take the same source file more than once and add \fB-a\fP and \fB-s\fP accordingly. .LP Some movies start synced correctly but slowly drift out of sync. For these kind of movies you can specify a delay factor that is applied to all timestamps - no data is added or removed. So if you make that factor too big or too small you'll get bad results. An example is that an episode I transcoded was 0.2 seconds out of sync at the end of the movie which was 77340 frames long. At 29.97fps 0.2 seconds correspond to approx. 6 frames. So I did .LP $ \fBogmmerge -o goodsync.ogm -s 0,77346/77340 outofsync.ogm\fP .LP The result was fine. .LP The sync options can also be used for subtitles in the same manner. .LP For text subtitles you can either use some Windows software (like \fBSubRipper\fR) or the \fBsubrip\fR package found in \fBtranscode(1)\fR's sources (in \fBcontrib/subrip\fR). The general process is: .TP 1. extract a raw subtitle stream from the source: .br $ \fBtccat -i /path/to/copied/dvd/ -T 1 -L | \\ .br tcextract -x ps1 -t vob -a 0x20 | \\ .br subtitle2pgm -o mymovie\fP .TP 2. convert the resulting PGM images to text with \fBgocr\fP: .br $ \fBpgm2txt mymovie\fP .TP 3. spell-check the resulting text files: .br $ \fBispell -d american *txt\fP .TP 4. convert the text files to a SRT file: .br $ \fBsrttool -s -w -i mymovie.srtx -o mymovie.srt\fP .LP The resulting file can be used as another input file for \fBogmmerge\fR: .LP $ \fBogmmerge -o mymovie.ogm -c 'TITLE=My Movie' mymovie.avi \\ .br -c LANGUAGE=English mymovie.ogg -c LANGUAGE=English mymovie.srt\fP .SH "FILE SIZE" .LP Using OGG as the container format introduces overhead - each OGG packet has a header, and each OGG packet can span one or more OGG pages, which itself again contain headers. Several tests show that the overhead is bigger than the overhead introduced by AVI (comparing video only files and files with video and MP3 audio). .LP The overhead is defined as \fIfile size\fR \- \fIraw stream size\fR. \fBmencoder\fR prints the raw stream size after encoding, so you'll be able to get that information rather easily. .LP Most of the times you want to calculate the overhead prior to encoding in order to adjust the bitrate accordingly. Unfortunately the overhead per frame is not constant \- only the percentage is constant. This percentage is calculated as 100 * (\fIOGG size\fR \- \fIraw size\fR) / \fIraw size\fR and seems to be somewhere between \fB1.1%\fR and \fB1.2%\fR. This depends on the number of streams and the stream types used. .LP The \fIraw size\fR itself can be approximated by .br \fIframes\fR * \fIvbitrate\fR .br \fIraw size\fR = ( ----------------- + \fIlength\fR * \fIabitrate\fR ) / 8 * 1000 * 1024 .br \fIframes per sec\fR .br assuming that \fIvbitrate\fR and \fIabitrate\fR are given in kbit/s = 1000 bit/s, and \fIlength\fR is given in seconds. .SH NOTES .LP What works: .TP * AVI as the video and audio source (currently only raw PCM, MP3 and AC3 audio tracks) .TP * OGG as the source for video, audio (Vorbis, raw PCM, MP3 and AC3 audio) and text streams (subtitles). .TP * WAV as the audio source .TP * MP3 audio files .TP * AC3 audio files .TP * Track selection .TP * Manual audio synchronization by adding silence/removing packets for Vorbis audio and for text streams by adjusting the starting point and duration. .TP * Manual audio synchronization for AC3 and MP3 audio by duplicating/removing packets at the beginning. .TP * Adding user comments to the mandatory comment headers (only the headers are mandatory. Comments themselves are not mandatory.) .TP * Text subtitles can be read from SRT (SubRipper / subrip) and MicroDVD files or taken from other OGM files. .TP * PCM, AC3 and MP3 audio work well under Windows and with MPlayer now. .TP * Chapter information as generated by \fBdvdxchap\fR are supported. .LP What not works: .TP * Manual audio synchronization for PCM sound (who needs it anyway?) .LP Planned functionality: .TP * support for other subtitle formats .SH CHAPTERS \fBogmmerge\fR supports chapter information as generated by \fBdvdxchap(1)\fR. The format is very simple: .LP CHAPTER01=HH:MM:SS.sss .br CHAPTER01NAME=the first chapter .br CHAPTER02=HH:MM:SS.sss .br CHAPTER02NAME=another chapter .LP with HH = hour, MM = minute, SS = seconds, sss = milliseconds. .LP The chapter information is stored in the video stream's comments. Therefore you could also specify the chapters with \fI-c CHAPTER01=...\fR Using a chapter file has an advantage: If the video stream's comments already contain chapter information and the command line contains a chapter information file then the existing chapter information will be completely replaced. .SH TECHNICAL ASPECTS .LP This section is not needed by the average user. .LP \fBogmmerge\fP consists of three parts: .TP * Demultiplexers (called readers) open and read input files specified on the command line and extract specific tracks. .TP * Packetizers (or output modules) take data from a demultiplexer and encapsulate them into OGG pages. These are stored in queues. .TP * The main program requests from every known demultiplexer that it should read some data. It then gets the OGG page with the smallest timestamp from all the packetizer queues. This page is written to the output file. .LP The general class definitions for the readers and the packetizers can be found in \fBogmmerge.h\fP. .LP The main loop expects that the queues managed by the demuxer's packetizers are filled with at least one page after a call to the demuxer's \fBread()\fP function. The demuxer must make sure that enough data is passed to each of its associated packetizers. Have a look at \fBr_ogm.cpp\fP. .LP A possible setup might look like this: .LP +-> p_video .br +-> r_avi -+ .br | +-> p_pcm .br | .br \fBogmmerge\fR -+-> r_ogm ---> p_vorbis .br | .br | +-> p_video .br | | .br +-> r_ogm -+-> p_vorbis .br | .br +-> p_vorbis .LP One AVI source with a video and an audio track, one OGG/OGM source with only one Vorbis track, another OGG/OGM source with a video and two Vorbis tracks. .SH AUTHOR .I ogmmerge was written by Moritz Bunkus . .SH SEE ALSO .BR ogmdemux (1), .BR ogmsplit (1), .BR ogminfo (1), .BR ogmcat (1), .BR dvdxchap (1) .SH WWW The newest version can always be found at .UR http://www.bunkus.org/videotools/ogmtools/ .UE ogmtools-1.5/subtitles.h0000644000076400234220000000160207540667324015055 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes subtitles.h subtitle queueing and checking helper class definition Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __SUBTITLES_H__ #define __SUBTITLES_H__ #include #include "ogmmerge.h" #include "p_textsubs.h" typedef struct sub_t { ogg_int64_t start, end; char *subs; sub_t *next; } sub_t; class subtitles_c { private: sub_t *first, *last; public: subtitles_c(); ~subtitles_c(); void add(ogg_int64_t, ogg_int64_t, char *); int check(); void process(textsubs_packetizer_c *); sub_t *get_next(); }; #endif ogmtools-1.5/r_ac3.cpp0000644000076400234220000000765707754371721014401 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes r_ac3.cpp AC3 demultiplexer module Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "ogmmerge.h" #include "ogmstreams.h" #include "queue.h" #include "r_ac3.h" #include "ac3_common.h" #define PROBESIZE 8192 int ac3_reader_c::probe_file(FILE *file, off_t size) { char buf[PROBESIZE]; int pos; ac3_header_t ac3header; if (size < PROBESIZE) return 0; if (fseeko(file, 0, SEEK_SET) != 0) return 0; if (fread(buf, 1, PROBESIZE, file) != PROBESIZE) { fseeko(file, 0, SEEK_SET); return 0; } fseeko(file, 0, SEEK_SET); pos = find_ac3_header((unsigned char *)buf, PROBESIZE, &ac3header); if ((pos < 0) || ((pos + ac3header.bytes) >= PROBESIZE)) return 0; pos = find_ac3_header((unsigned char *)&buf[ac3header.bytes], PROBESIZE - pos - ac3header.bytes, &ac3header); if (pos != 0) return 0; return 1; } ac3_reader_c::ac3_reader_c(char *fname, audio_sync_t *nasync, range_t *nrange, char **ncomments) throw (error_c) { int pos; ac3_header_t ac3header; if ((file = fopen(fname, "r")) == NULL) throw error_c("ac3_reader: Could not open source file."); if (fseeko(file, 0, SEEK_END) != 0) throw error_c("ac3_reader: Could not seek to end of file."); size = ftello(file); if (fseeko(file, 0, SEEK_SET) != 0) throw error_c("ac3_reader: Could not seek to beginning of file."); chunk = (unsigned char *)malloc(4096); if (chunk == NULL) die("malloc"); if (fread(chunk, 1, 4096, file) != 4096) throw error_c("ac3_reader: Could not read 4096 bytes."); if (fseeko(file, 0, SEEK_SET) != 0) throw error_c("ac3_reader: Could not seek to beginning of file."); pos = find_ac3_header(chunk, 4096, &ac3header); if (pos < 0) throw error_c("ac3_reader: No valid AC3 packet found in the first " \ "4096 bytes.\n"); bytes_processed = 0; ac3packetizer = new ac3_packetizer_c(ac3header.sample_rate, ac3header.channels, ac3header.bit_rate / 1000, nasync, nrange, ncomments); if (verbose) fprintf(stderr, "Using AC3 demultiplexer for %s.\n+-> Using " \ "AC3 output module for audio stream.\n", fname); } ac3_reader_c::~ac3_reader_c() { if (file != NULL) fclose(file); if (chunk != NULL) free(chunk); if (ac3packetizer != NULL) delete ac3packetizer; } int ac3_reader_c::read() { int nread, last_frame; do { if (ac3packetizer->page_available()) return EMOREDATA; nread = fread(chunk, 1, 4096, file); if (nread <= 0) { ac3packetizer->produce_eos_packet(); return 0; } last_frame = (nread == 4096 ? 0 : 1); ac3packetizer->process((char *)chunk, nread, last_frame); bytes_processed += nread; if (last_frame) return 0; } while (1); } int ac3_reader_c::serial_in_use(int serial) { return ac3packetizer->serial_in_use(serial); } ogmmerge_page_t *ac3_reader_c::get_header_page(int header_type) { return ac3packetizer->get_header_page(header_type); } ogmmerge_page_t *ac3_reader_c::get_page() { return ac3packetizer->get_page(); } void ac3_reader_c::reset() { if (ac3packetizer != NULL) ac3packetizer->reset(); } int ac3_reader_c::display_priority() { return DISPLAYPRIORITY_HIGH - 1; } void ac3_reader_c::display_progress() { fprintf(stdout, "progress: %lld/%lld bytes (%d%%)\r", bytes_processed, size, (int)(bytes_processed * 100L / size)); fflush(stdout); } ogmtools-1.5/Makefile.am0000644000076400234220000000402507655160106014715 0ustar mosuvj00000000000000## process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = dist-zip foreign SUBDIRS = avilib if HAVE_LIBDVDREAD DVDXCHAP=dvdxchap DVDXCHAP_MAN=dvdxchap.1 INCLUDES=$(DVDREAD_CFLAGS) endif bin_PROGRAMS = ogmmerge ogmdemux ogminfo ogmsplit ogmcat $(DVDXCHAP) ogmmerge_SOURCES = ogmmerge.cpp ogmmerge.h ogmstreams.h \ r_avi.cpp r_avi.h \ r_ogm.cpp r_ogm.h \ r_ac3.cpp r_ac3.h \ r_mp3.cpp r_mp3.h \ r_wav.cpp r_wav.h \ r_microdvd.cpp r_microdvd.h \ r_srt.cpp r_srt.h \ r_vobsub.cpp r_vobsub.h \ p_video.cpp p_video.h \ p_index.cpp p_index.h \ p_ac3.cpp p_ac3.h \ p_mp3.cpp p_mp3.h \ p_pcm.cpp p_pcm.h \ p_vorbis.cpp p_vorbis.h \ p_textsubs.cpp p_textsubs.h \ p_vobsub.cpp p_vobsub.h \ ac3_common.c ac3_common.h \ mp3_common.c mp3_common.h \ subtitles.cpp subtitles.h \ queue.cpp queue.h \ vorbis_header_utils.c vorbis_header_utils.h \ generic.cpp generic.h \ common.c common.h ogmmerge_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @VORBISENC_LIBS@ @AVILIB_LIBS@ \ @PROFILING_LIBS@ ogmdemux_SOURCES = ogmdemux.c ogmstreams.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogmdemux_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @AVILIB_LIBS@ @PROFILING_LIBS@ ogminfo_SOURCES = ogminfo.c ogmstreams.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogminfo_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @PROFILING_LIBS@ ogmsplit_SOURCES = ogmsplit.cpp \ queue.cpp queue.h \ ogmmerge.h ogmstreams.h \ generic.cpp generic.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogmsplit_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @PROFILING_LIBS@ ogmcat_SOURCES = ogmcat.cpp \ queue.cpp queue.h \ ogmmerge.h ogmstreams.h \ generic.cpp generic.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogmcat_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @PROFILING_LIBS@ dvdxchap_SOURCES = dvdxchap.c dvdxchap_LDADD = @DVDREAD_LIBS@ man_MANS=ogmsplit.1 ogminfo.1 ogmmerge.1 ogmdemux.1 ogmcat.1 $(DVDXCHAP_MAN) EXTRA_DIST = $(man_MANS) ogmtools-1.5/ogmcat.10000644000076400234220000000661110143371176014215 0ustar mosuvj00000000000000.TH OGMCAT "1" "November 2004" "ogmcat v1.5" "User Commands" .SH NAME ogmcat \- Concatenate several OGG/OGM files into one big OGG/OGM file .SH SYNOPSIS .B ogmcat [\fIoptions\fR] \-o \fIoutname\fR \fIinname1\fR [\fIinname2\fR [\fIinname3\fR ...]] .SH DESCRIPTION .LP \fBogmcat does NOT work at the moment. It is work in progress. I included it just out of laziness (otherwise I'd have to remove it from the Makefile/configure stuff prior to releasing this version).\fR .LP \fBogmcat\fP can be used to concatenate several OGG/OGM files into one big file if they are of the same type. For a more in-depth description refer to the \fBLIMITATIONS\fR section. .TP \fB\-o\fR, \fB\-\-output\fR \fIoutname\fR Output to '\fIoutname\fR'. .TP inname1 Use '\fIinname1\fR', '\fIinname2\fR' etc as the sources. .TP \fB\-m\fR, \fB\-\-manualsync\fR \fIn\fR Specifies a manual sync value in ms that will be added to each stream's presentation timestamps along with the value calculated by the chosen sync algorithm (see the \fB\-s\fR option). This option can be used for each input file although it has no effect if used for the first one as well. .TP \fB\-s\fR, \fB\-\-sync\fR \fInr\fR Uses sync mode \fInr\fR. Valid values are 0\ \-\ 4. The default value is shown on \fBogmcat\fR's help screen. .TP \fB\-n\fR, \fB\-\-nosafetychecks\fR Disable the safety checks made prior to the concatenating. The resulting file may be unplayable. See the \fBLIMITATIONS\fR section for further details. .TP \fB\-v\fR, \fB\-\-verbose\fR Be verbose and show each OGG packet. Can be used twice to increase verbosity. .TP \fB\-h\fR, \fB\-\-help\fR Show this help. .TP \fB\-V\fR, \fB\-\-version\fR Show version information. .SH LIMITATIONS Concatenating streams is difficult at the best and might even be impossible. Therefore \fBogmcat\fR makes very strict comparisons between the streams contained in the input files. The checks done include: .TP * general: All streams with the same serial number must be of the same type (video, audio, Vorbis audio or text streams). .TP * general: If a stream exists in one file it \fBmust\fR in the other files as well. .TP * video streams: The codec FourCC, width, height and FPS must match. .TP * Vorbis streams: The sample rate and the number of channels must match. .TP * other audio streams: The codec ID, sample rate, bits per sample and number of channels must match. .TP * text/subtitle streams: The 'time unit' must match. .LP The user can forcefully override the last four checks with the \fB\-n\fR parameter. The checks marked as 'general' cannot be overridden this way. .LP Audio/video synchronization might not be ok in the resulting file even if the source files were perfectly in sync. The user can experiment with the \fB\-s\fR parameter which causes \fBogmcat\fR to use slightly different algorithms for calculating the granulepos values for the audio and text streams. The range of valid parameters will be printed on \fBogmcat\fR's help screen. .LP If none of the synchronization algorithms provided works correctly then the user can also manually add a synchronization offset using the \fB\-m\fR option for each input file. .SH AUTHOR .I ogmcat was written by Moritz Bunkus . .SH SEE ALSO .BR ogmmerge (1), .BR ogminfo (1), .BR ogmdemux (1), .BR ogmsplit (1), .BR dvdxchap (1) .SH WWW The newest version can always be found at .UR http://www.bunkus.org/videotools/ogmtools/ .UE ogmtools-1.5/common.c0000644000076400234220000001067707757242303014332 0ustar mosuvj00000000000000#include #include #include #include #ifdef NEED_FSEEKO #include #include #endif #include "common.h" void _die(const char *s, const char *file, int line) { fprintf(stderr, "die @ %s/%d : %s\n", file, line, s); exit(1); } ogg_packet *duplicate_ogg_packet(ogg_packet *src) { ogg_packet *dst; dst = (ogg_packet *)malloc(sizeof(ogg_packet)); if (dst == NULL) die("malloc"); memcpy(dst, src, sizeof(ogg_packet)); dst->packet = (unsigned char *)malloc(src->bytes); if (dst->packet == NULL) die("malloc"); memcpy(dst->packet, src->packet, src->bytes); return dst; } char **dup_comments(char **comments) { char **new_comments; int nc; if (comments == NULL) return NULL; for (nc = 0; comments[nc] != NULL; nc++) ; new_comments = (char **)malloc(sizeof(char *) * nc + 1); if (new_comments == NULL) die("malloc"); for (nc = 0; comments[nc] != NULL; nc++) { new_comments[nc] = strdup(comments[nc]); if (new_comments[nc] == NULL) die("strdup"); } new_comments[nc] = NULL; return new_comments; } void free_comments(char **comments) { int i; if (comments != NULL) { for (i = 0; comments[i] != NULL; i++) free(comments[i]); free(comments); } } u_int16_t get_uint16(const void *buf) { u_int16_t ret; unsigned char *tmp; tmp = (unsigned char *)buf; ret = tmp[1] & 0xff; ret = (ret << 8) + (tmp[0] & 0xff); return ret; } u_int32_t get_uint32(const void *buf) { u_int32_t ret; unsigned char *tmp; tmp = (unsigned char *)buf; ret = tmp[3] & 0xff; ret = (ret << 8) + (tmp[2] & 0xff); ret = (ret << 8) + (tmp[1] & 0xff); ret = (ret << 8) + (tmp[0] & 0xff); return ret; } u_int64_t get_uint64(const void *buf) { u_int64_t ret; unsigned char *tmp; tmp = (unsigned char *) buf; ret = tmp[7] & 0xff; ret = (ret << 8) + (tmp[6] & 0xff); ret = (ret << 8) + (tmp[5] & 0xff); ret = (ret << 8) + (tmp[4] & 0xff); ret = (ret << 8) + (tmp[3] & 0xff); ret = (ret << 8) + (tmp[2] & 0xff); ret = (ret << 8) + (tmp[1] & 0xff); ret = (ret << 8) + (tmp[0] & 0xff); return ret; } void put_uint16(void *buf, u_int16_t val) { unsigned char *tmp; tmp = (unsigned char *) buf; tmp[0] = val & 0xff; tmp[1] = (val >>= 8) & 0xff; } void put_uint32(void *buf, u_int32_t val) { unsigned char *tmp; tmp = (unsigned char *) buf; tmp[0] = val & 0xff; tmp[1] = (val >>= 8) & 0xff; tmp[2] = (val >>= 8) & 0xff; tmp[3] = (val >>= 8) & 0xff; } void put_uint64(void *buf, u_int64_t val) { unsigned char *tmp; tmp = (unsigned char *) buf; tmp[0] = val & 0xff; tmp[1] = (val >>= 8) & 0xff; tmp[2] = (val >>= 8) & 0xff; tmp[3] = (val >>= 8) & 0xff; tmp[4] = (val >>= 8) & 0xff; tmp[5] = (val >>= 8) & 0xff; tmp[6] = (val >>= 8) & 0xff; tmp[7] = (val >>= 8) & 0xff; } #ifdef NEED_FSEEKO /* * On BSD/OS and NetBSD, off_t and fpos_t are the same. Standards * say off_t is an arithmetic type, but not necessarily integral, * while fpos_t might be neither. */ int fseeko(FILE *stream, off_t offset, int whence) { off_t floc; struct stat filestat; switch (whence) { case SEEK_CUR: flockfile(stream); if (fgetpos(stream, &floc) != 0) goto failure; floc += offset; if (fsetpos(stream, &floc) != 0) goto failure; funlockfile(stream); return 0; break; case SEEK_SET: if (fsetpos(stream, &offset) != 0) return -1; return 0; break; case SEEK_END: flockfile(stream); if (fstat(fileno(stream), &filestat) != 0) goto failure; floc = filestat.st_size; if (fsetpos(stream, &floc) != 0) goto failure; funlockfile(stream); return 0; break; default: errno = EINVAL; return -1; } failure: funlockfile(stream); return -1; } off_t ftello(FILE *stream) { off_t floc; if (fgetpos(stream, &floc) != 0) return -1; return floc; } #endif /* NEED_FSEEKO */ #define COPY(m, s) memcpy(&dst->m, &src->m, s) void copy_headers(stream_header *dst, old_stream_header *src, int size) { if (size == sizeof(old_stream_header)) { COPY(streamtype[0], 8); COPY(subtype[0], 4); COPY(size, 4); COPY(time_unit, 8); COPY(samples_per_unit, 8); COPY(default_len, 4); COPY(buffersize, 4); COPY(bits_per_sample, 2); COPY(sh, sizeof(stream_header_video)); } else memcpy(dst, src, size); } ogmtools-1.5/queue.h0000644000076400234220000000336007620146463014161 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes queue.h class definitions for the OGG page queueing class Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __UTIL_H__ #define __UTIL_H__ #include #include "ogmmerge.h" #include "ogmstreams.h" // q_page_t is used internally only typedef struct q_page { ogmmerge_page_t *mpage; struct q_page *next; } q_page_t; class q_c: public generic_packetizer_c { private: struct q_page *first; struct q_page *current; int next_is_key; protected: ogg_stream_state os; public: q_c() throw (error_c); virtual ~q_c(); virtual int add_ogg_page(ogg_page *, int header_page, int index_serial); virtual int flush_pages(int header_page = 0); virtual int queue_pages(int header_page = 0); virtual void next_page_contains_keyframe(int serial); virtual ogmmerge_page_t *get_page(); virtual ogmmerge_page_t *get_header_page(int header_type = PACKET_TYPE_HEADER); virtual int page_available(); virtual int header_page_available(); virtual stamp_t make_timestamp(ogg_int64_t granulepos) = 0; virtual stamp_t get_smallest_timestamp(); virtual long get_queued_bytes(); private: static ogg_page *copy_ogg_page(ogg_page *); }; #endif /* __UTIL_H__ */ ogmtools-1.5/common.h0000644000076400234220000000361407757237160014335 0ustar mosuvj00000000000000/* ogmmerge -- utility for splicing together ogg bitstreams from component media subtypes ogmmerge.h general class and type definitions Written by Moritz Bunkus Based on Xiph.org's 'oggmerge' found in their CVS repository See http://www.xiph.org Distributed under the GPL see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html */ #ifndef __COMMON_H #define __COMMON_H #ifdef __cplusplus extern "C" { #endif #ifdef NEED_FSEEKO #include #endif #include #include "ogmstreams.h" #define VERSIONINFO "ogmtools v" VERSION extern int verbose; /* errors */ #define EMOREDATA -1 #define EMALLOC -2 #define EBADHEADER -3 #define EBADEVENT -4 #define EOTHER -5 /* types */ #define TYPEUNKNOWN 0 #define TYPEOGM 1 #define TYPEAVI 2 #define TYPEWAV 3 #define TYPESRT 4 #define TYPEMP3 5 #define TYPEAC3 6 #define TYPECHAPTERS 7 #define TYPEMICRODVD 8 #define TYPEVOBSUB 9 #define die(a) _die(a, __FILE__, __LINE__) void _die(const char *, const char *, int); #define FOURCC(a, b, c, d) (unsigned long)((((unsigned char)a) << 24) + \ (((unsigned char)b) << 16) + \ (((unsigned char)c) << 8) + \ ((unsigned char)d)) char **dup_comments(char **comments); void free_comments(char **comments); ogg_packet *duplicate_ogg_packet(ogg_packet *src); u_int16_t get_uint16(const void *buf); u_int32_t get_uint32(const void *buf); u_int64_t get_uint64(const void *buf); void put_uint16(void *buf, u_int16_t); void put_uint32(void *buf, u_int32_t); void put_uint64(void *buf, u_int64_t); void copy_headers(stream_header *dst, old_stream_header *src, int size); #ifdef NEED_FSEEKO int fseeko(FILE *, off_t, int); off_t ftello(FILE *); #endif /* NEED_FSEEKO */ #ifdef __cplusplus } #endif #endif ogmtools-1.5/aclocal.m40000644000076400234220000011334210143371301014507 0ustar mosuvj00000000000000# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. dnl PATH_AVILIB([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for avilib, and define AVILIB_CFLAGS and AVILIB_LIBS dnl AC_DEFUN(PATH_AVILIB, [dnl dnl Get the cflags and libraries dnl AVILIB_CFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_CXXFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_LIBS="-Lavilib -lavi" AC_SUBST(AVILIB_CFLAGS) AC_SUBST(AVILIB_CXXFLAGS) AC_SUBST(AVILIB_LIBS) ]) # Configure paths for libogg # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS dnl AC_DEFUN(XIPH_PATH_OGG, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(ogg-prefix,[ --with-ogg-prefix=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="") AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes) if test "x$ogg_prefix" != "x"; then ogg_args="$ogg_args --prefix=$ogg_prefix" OGG_CFLAGS="-I$ogg_prefix/include" OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE"; then ogg_args="$ogg_args --prefix=$prefix" OGG_CFLAGS="-I$prefix/include" OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" AC_MSG_CHECKING(for Ogg) no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" dnl dnl Now check if the installed Ogg is sufficiently new. dnl rm -f conf.oggtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(OGG_CFLAGS) AC_SUBST(OGG_LIBS) rm -f conf.oggtest ]) # Configure paths for libvorbis # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS dnl AC_DEFUN(XIPH_PATH_VORBIS, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(vorbis-prefix,[ --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="") AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes) if test "x$vorbis_prefix" != "x" ; then vorbis_args="$vorbis_args --prefix=$vorbis_prefix" VORBIS_CFLAGS="-I$vorbis_prefix/include" VORBIS_LIBDIR="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then vorbis_args="$vorbis_args --prefix=$prefix" VORBIS_CFLAGS="-I$prefix/include" VORBIS_LIBDIR="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" AC_MSG_CHECKING(for Vorbis) no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" dnl dnl Now check if the installed Vorbis is sufficiently new. dnl rm -f conf.vorbistest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(VORBIS_CFLAGS) AC_SUBST(VORBIS_LIBS) AC_SUBST(VORBISFILE_LIBS) AC_SUBST(VORBISENC_LIBS) rm -f conf.vorbistest ]) dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) dnl check if $CC supports a given set of cflags AC_DEFUN([AC_TRY_CFLAGS], [AC_MSG_CHECKING([if $CC supports $1 flags]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$1" AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no]) CFLAGS="$SAVE_CFLAGS" AC_MSG_RESULT([$ac_cv_try_cflags_ok]) if test x"$ac_cv_try_cflags_ok" = x"yes"; then ifelse([$2],[],[:],[$2]) else ifelse([$3],[],[:],[$3]) fi]) AC_DEFUN(PATH_DEBUG,[ AC_ARG_ENABLE([debug], [ --enable-debug compile with debug information]) if test x"$enable_debug" = x"yes"; then dnl debug information DEBUG_CFLAGS="-g -DDEBUG" else DEBUG_CFLAGS="" fi AC_SUBST(DEBUG_CFLAGS) ]) AC_DEFUN(PATH_PROFILING,[ AC_ARG_ENABLE([profiling], [ --enable-profiling compile with profiling information]) if test x"$enable_profiling" = x"yes"; then dnl profiling information PROFILING_CFLAGS="-pg" PROFILING_LIBS="-lc_p" else PROFILING_CFLAGS="" PROFILING_LIBS="" fi AC_SUBST(PROFILING_CFLAGS) AC_SUBST(PROFILING_LIBS) ]) dnl AM_PATH_LIBDVDREAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for LIBDVDREAD, and define LIBDVDREAD_CFLAGS and LIBDVDREAD_LIBS dnl AC_DEFUN(AM_PATH_LIBDVDREAD, [ AC_ARG_WITH(dvdread,[ --with-dvdread use installed libdvdread library (default=yes)],[case "${withval}" in yes) with_dvdread=yes;; no) with_dvdread=no ;; *) AC_MSG_ERROR(bad value ${withval} for --with-dvdread) ;; esac], with_dvdread=yes) AC_ARG_WITH(dvdread-includes,[ --with-dvdread-includes=PFX prefix where local dvdread includes are installed (optional)], dvdread_includes="$withval",dvdread_includes="") AC_ARG_WITH(dvdread-libs,[ --with-dvdread-libs=PFX prefix where local dvdread lib is installed (optional)], dvdread_libs="$withval", dvdread_libs="") DVDREAD_LIBS="" DVDREAD_CFLAGS="" have_dvdread=no if test x$with_dvdread = "x"yes ; then if test x$dvdread_includes != "x" ; then with_dvdread_i="$dvdread_includes/include" else with_dvdread_i="/usr/include" fi if test x$dvdread_libs != x ; then with_dvdread_l="$dvdread_libs/lib" else with_dvdread_l="/usr/lib" fi AC_CHECK_LIB(dvdread, DVDOpen, [DVDREAD_CFLAGS="-I$with_dvdread_i -I/usr/local/include" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread -lm" AC_DEFINE(HAVE_LIBDVDREAD) have_dvdread=yes], have_dvdread=no, -L$with_dvdread_l -ldvdread -lm) AC_CHECK_FILE($with_dvdread_i/dvdread/dvd_reader.h, [AC_DEFINE(HAVE_LIBDVDREAD_INC) dvdread_inc=yes]) if test x"$dvdread_inc" != xyes; then AC_CHECK_FILE(/usr/local/include/dvdread/dvd_reader.h, [AC_DEFINE(HAVE_LIBDVDREAD_INC) dvdread_inc=yes]) fi if test x"$have_dvdread" != "xyes"; then dnl use included lib with_dvdread_i="../dvdread" with_dvdread_l="../dvdread" AC_CHECK_FILE(./dvdread/dvd_reader.h, [AC_DEFINE(HAVE_LIBDVDREAD) have_dvdread=yes DVDREAD_CFLAGS="-I$with_dvdread_i" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread_tc"], have_dvdread=no) fi if test x"$have_dvdread" != "xyes"; then echo '***********************************' echo 'libdvdread not found. dvdxchap will' echo 'not be compiled.' echo '***********************************' fi fi AC_SUBST(DVDREAD_CFLAGS) AC_SUBST(DVDREAD_LIBS) ]) # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if # your package does certain things. But this isn't really a big deal. # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... AC_PREREQ([2.52]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_][CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_][CC], defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_][CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_][CXX], defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.6.3])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # # Check to make sure that the build environment is sane. # # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # -*- Autoconf -*- # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. # Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50]) AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # AM_PROG_INSTALL_STRIP # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # serial 4 -*- Autoconf -*- # Copyright 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_$1_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null AC_SUBST([DEPDIR]) ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST(am__include) AC_SUBST(am__quote) AC_MSG_RESULT($_am_result) rm -f confinc confmf ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 5 AC_PREREQ(2.52) # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([conditional \"$1\" was never defined. Usually this means the macro was only invoked conditionally.]) fi])]) ogmtools-1.5/autom4te.cache/0000755000076400234220000000000010143371302015450 5ustar mosuvj00000000000000ogmtools-1.5/autom4te.cache/requests0000644000076400234220000001210110143371302017241 0ustar mosuvj00000000000000# This file was generated by Autom4te Sun Jun 20 16:43:36 PDT 2004. # It contains the lists of macros which have been traced. # It can be safely removed. @request = ( bless( [ '0', 1, [ '/usr/share/autoconf' ], [ '/usr/share/autoconf/autoconf/autoconf.m4f', 'aclocal.m4', 'configure.in' ], { 'm4_pattern_forbid' => 1, 'AC_CONFIG_LIBOBJ_DIR' => 1, 'AC_TYPE_OFF_T' => 1, 'AC_C_VOLATILE' => 1, 'AC_FUNC_CLOSEDIR_VOID' => 1, 'AC_REPLACE_FNMATCH' => 1, 'AC_PROG_LIBTOOL' => 1, 'AC_FUNC_STAT' => 1, 'AC_HEADER_TIME' => 1, 'AC_FUNC_WAIT3' => 1, 'AM_AUTOMAKE_VERSION' => 1, 'AC_STRUCT_TM' => 1, 'AC_FUNC_LSTAT' => 1, 'AC_TYPE_MODE_T' => 1, 'AC_FUNC_GETMNTENT' => 1, 'AC_FUNC_STRTOD' => 1, 'AC_CHECK_HEADERS' => 1, 'AC_FUNC_STRNLEN' => 1, 'm4_sinclude' => 1, 'AC_PROG_CXX' => 1, 'AC_PATH_X' => 1, 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, 'AC_PROG_AWK' => 1, '_m4_warn' => 1, 'AC_HEADER_STDC' => 1, 'AC_HEADER_MAJOR' => 1, 'AC_FUNC_ERROR_AT_LINE' => 1, 'AC_PROG_GCC_TRADITIONAL' => 1, 'AC_LIBSOURCE' => 1, 'AC_FUNC_MBRTOWC' => 1, 'AC_STRUCT_ST_BLOCKS' => 1, 'AC_TYPE_SIGNAL' => 1, 'AC_TYPE_UID_T' => 1, 'AC_CONFIG_AUX_DIR' => 1, 'AC_PROG_MAKE_SET' => 1, 'sinclude' => 1, 'm4_pattern_allow' => 1, 'AC_DEFINE_TRACE_LITERAL' => 1, 'AC_FUNC_STRERROR_R' => 1, 'AC_PROG_CC' => 1, 'AC_FUNC_FORK' => 1, 'AC_DECL_SYS_SIGLIST' => 1, 'AC_FUNC_VPRINTF' => 1, 'AC_FUNC_STRCOLL' => 1, 'AC_PROG_YACC' => 1, 'AC_INIT' => 1, 'AC_STRUCT_TIMEZONE' => 1, 'AC_FUNC_CHOWN' => 1, 'AC_SUBST' => 1, 'AC_FUNC_ALLOCA' => 1, 'AC_CANONICAL_HOST' => 1, 'AC_FUNC_GETPGRP' => 1, 'AC_PROG_RANLIB' => 1, 'AM_INIT_AUTOMAKE' => 1, 'AC_FUNC_SETPGRP' => 1, 'AC_CONFIG_SUBDIRS' => 1, 'AC_FUNC_MMAP' => 1, 'AC_FUNC_REALLOC' => 1, 'AC_TYPE_SIZE_T' => 1, 'AC_CONFIG_LINKS' => 1, 'AC_CHECK_TYPES' => 1, 'AC_CHECK_MEMBERS' => 1, 'AM_MAINTAINER_MODE' => 1, 'AC_FUNC_UTIME_NULL' => 1, 'AC_FUNC_SELECT_ARGTYPES' => 1, 'AC_FUNC_STRFTIME' => 1, 'AC_HEADER_STAT' => 1, 'AC_C_INLINE' => 1, 'AC_PROG_CPP' => 1, 'AC_TYPE_PID_T' => 1, 'AC_C_CONST' => 1, 'AC_PROG_LEX' => 1, 'AC_CONFIG_FILES' => 1, 'include' => 1, 'AC_FUNC_SETVBUF_REVERSED' => 1, 'AC_PROG_INSTALL' => 1, 'AM_GNU_GETTEXT' => 1, 'AC_FUNC_OBSTACK' => 1, 'AC_CHECK_LIB' => 1, 'AC_FUNC_MALLOC' => 1, 'AC_FUNC_GETGROUPS' => 1, 'AC_FUNC_GETLOADAVG' => 1, 'AH_OUTPUT' => 1, 'AC_FUNC_FSEEKO' => 1, 'AM_PROG_CC_C_O' => 1, 'AM_CONDITIONAL' => 1, 'AC_CANONICAL_SYSTEM' => 1, 'AC_FUNC_MKTIME' => 1, 'AC_CONFIG_HEADERS' => 1, 'AC_HEADER_SYS_WAIT' => 1, 'AC_FUNC_MEMCMP' => 1, 'AC_PROG_LN_S' => 1, 'm4_include' => 1, 'AC_HEADER_DIRENT' => 1, 'AC_CHECK_FUNCS' => 1 } ], 'Autom4te::Request' ) ); ogmtools-1.5/autom4te.cache/traces.00000644000076400234220000003056410143371302017022 0ustar mosuvj00000000000000m4trace:aclocal.m4:385: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) m4trace:configure.in:3: -1- AC_INIT([ogmmerge.cpp]) m4trace:configure.in:3: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.in:3: -1- m4_pattern_forbid([_AC_]) m4trace:configure.in:3: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) m4trace:configure.in:3: -1- m4_pattern_allow([^AS_FLAGS$]) m4trace:configure.in:3: -1- m4_pattern_forbid([^_?m4_]) m4trace:configure.in:3: -1- m4_pattern_forbid([^dnl$]) m4trace:configure.in:3: -1- m4_pattern_forbid([^_?AS_]) m4trace:configure.in:3: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) m4trace:configure.in:3: -1- AC_SUBST([PATH_SEPARATOR]) m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) m4trace:configure.in:3: -1- AC_SUBST([exec_prefix], [NONE]) m4trace:configure.in:3: -1- AC_SUBST([prefix], [NONE]) m4trace:configure.in:3: -1- AC_SUBST([program_transform_name], [s,x,x,]) m4trace:configure.in:3: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) m4trace:configure.in:3: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) m4trace:configure.in:3: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) m4trace:configure.in:3: -1- AC_SUBST([datadir], ['${prefix}/share']) m4trace:configure.in:3: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) m4trace:configure.in:3: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) m4trace:configure.in:3: -1- AC_SUBST([localstatedir], ['${prefix}/var']) m4trace:configure.in:3: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) m4trace:configure.in:3: -1- AC_SUBST([includedir], ['${prefix}/include']) m4trace:configure.in:3: -1- AC_SUBST([oldincludedir], ['/usr/include']) m4trace:configure.in:3: -1- AC_SUBST([infodir], ['${prefix}/info']) m4trace:configure.in:3: -1- AC_SUBST([mandir], ['${prefix}/man']) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ #undef PACKAGE_NAME]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ #undef PACKAGE_VERSION]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ #undef PACKAGE_STRING]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT]) m4trace:configure.in:3: -1- AC_SUBST([build_alias]) m4trace:configure.in:3: -1- AC_SUBST([host_alias]) m4trace:configure.in:3: -1- AC_SUBST([target_alias]) m4trace:configure.in:3: -1- AC_SUBST([DEFS]) m4trace:configure.in:3: -1- AC_SUBST([ECHO_C]) m4trace:configure.in:3: -1- AC_SUBST([ECHO_N]) m4trace:configure.in:3: -1- AC_SUBST([ECHO_T]) m4trace:configure.in:3: -1- AC_SUBST([LIBS]) m4trace:configure.in:4: -1- AM_INIT_AUTOMAKE([ogmtools], [1.5]) m4trace:configure.in:4: -1- AM_AUTOMAKE_VERSION([1.6.3]) m4trace:configure.in:4: -1- AC_PROG_INSTALL m4trace:configure.in:4: -1- AC_SUBST([INSTALL_PROGRAM]) m4trace:configure.in:4: -1- AC_SUBST([INSTALL_SCRIPT]) m4trace:configure.in:4: -1- AC_SUBST([INSTALL_DATA]) m4trace:configure.in:4: -1- AC_SUBST([PACKAGE], [ogmtools]) m4trace:configure.in:4: -1- AC_SUBST([VERSION], [1.5]) m4trace:configure.in:4: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) m4trace:configure.in:4: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ #undef PACKAGE]) m4trace:configure.in:4: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) m4trace:configure.in:4: -1- AH_OUTPUT([VERSION], [/* Version number of package */ #undef VERSION]) m4trace:configure.in:4: -1- AC_SUBST([ACLOCAL]) m4trace:configure.in:4: -1- AC_SUBST([AUTOCONF]) m4trace:configure.in:4: -1- AC_SUBST([AUTOMAKE]) m4trace:configure.in:4: -1- AC_SUBST([AUTOHEADER]) m4trace:configure.in:4: -1- AC_SUBST([MAKEINFO]) m4trace:configure.in:4: -1- AC_SUBST([AMTAR]) m4trace:configure.in:4: -1- AC_SUBST([install_sh]) m4trace:configure.in:4: -1- AC_SUBST([STRIP]) m4trace:configure.in:4: -1- AC_SUBST([ac_ct_STRIP]) m4trace:configure.in:4: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) m4trace:configure.in:4: -1- AC_PROG_AWK m4trace:configure.in:4: -1- AC_SUBST([AWK]) m4trace:configure.in:4: -1- AC_PROG_MAKE_SET m4trace:configure.in:4: -1- AC_SUBST([SET_MAKE]) m4trace:configure.in:6: -1- AC_PROG_CC m4trace:configure.in:6: -1- AC_SUBST([CC]) m4trace:configure.in:6: -1- AC_SUBST([CFLAGS]) m4trace:configure.in:6: -1- AC_SUBST([LDFLAGS]) m4trace:configure.in:6: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.in:6: -1- AC_SUBST([CC]) m4trace:configure.in:6: -1- AC_SUBST([ac_ct_CC]) m4trace:configure.in:6: -1- AC_SUBST([CC]) m4trace:configure.in:6: -1- AC_SUBST([ac_ct_CC]) m4trace:configure.in:6: -1- AC_SUBST([CC]) m4trace:configure.in:6: -1- AC_SUBST([CC]) m4trace:configure.in:6: -1- AC_SUBST([ac_ct_CC]) m4trace:configure.in:6: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) m4trace:configure.in:6: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) m4trace:configure.in:6: -1- AC_SUBST([DEPDIR]) m4trace:configure.in:6: -1- AC_SUBST([am__include]) m4trace:configure.in:6: -1- AC_SUBST([am__quote]) m4trace:configure.in:6: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) m4trace:configure.in:6: -1- AC_SUBST([AMDEP_TRUE]) m4trace:configure.in:6: -1- AC_SUBST([AMDEP_FALSE]) m4trace:configure.in:6: -1- AC_SUBST([AMDEPBACKSLASH]) m4trace:configure.in:6: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) m4trace:configure.in:7: -1- AC_PROG_CXX m4trace:configure.in:7: -1- AC_SUBST([CXX]) m4trace:configure.in:7: -1- AC_SUBST([CXXFLAGS]) m4trace:configure.in:7: -1- AC_SUBST([LDFLAGS]) m4trace:configure.in:7: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.in:7: -1- AC_SUBST([CXX]) m4trace:configure.in:7: -1- AC_SUBST([ac_ct_CXX]) m4trace:configure.in:7: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) m4trace:configure.in:8: -1- AC_PROG_GCC_TRADITIONAL m4trace:configure.in:8: -1- AC_PROG_CPP m4trace:configure.in:8: -1- AC_SUBST([CPP]) m4trace:configure.in:8: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.in:8: -1- AC_SUBST([CPP]) m4trace:configure.in:8: -1- AC_SUBST([EGREP]) m4trace:configure.in:9: -1- AC_PROG_CPP m4trace:configure.in:9: -1- AC_SUBST([CPP]) m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.in:9: -1- AC_SUBST([CPP]) m4trace:configure.in:10: -1- AC_PROG_RANLIB m4trace:configure.in:10: -1- AC_SUBST([RANLIB]) m4trace:configure.in:10: -1- AC_SUBST([ac_ct_RANLIB]) m4trace:configure.in:12: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... aclocal.m4:126: XIPH_PATH_OGG is expanded from... configure.in:12: the top level]) m4trace:configure.in:12: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... aclocal.m4:126: XIPH_PATH_OGG is expanded from... configure.in:12: the top level]) m4trace:configure.in:12: -1- AC_SUBST([OGG_CFLAGS]) m4trace:configure.in:12: -1- AC_SUBST([OGG_LIBS]) m4trace:configure.in:13: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... aclocal.m4:226: XIPH_PATH_VORBIS is expanded from... configure.in:13: the top level]) m4trace:configure.in:13: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... aclocal.m4:226: XIPH_PATH_VORBIS is expanded from... configure.in:13: the top level]) m4trace:configure.in:13: -1- AC_SUBST([VORBIS_CFLAGS]) m4trace:configure.in:13: -1- AC_SUBST([VORBIS_LIBS]) m4trace:configure.in:13: -1- AC_SUBST([VORBISFILE_LIBS]) m4trace:configure.in:13: -1- AC_SUBST([VORBISENC_LIBS]) m4trace:configure.in:14: -1- AC_SUBST([AVILIB_CFLAGS]) m4trace:configure.in:14: -1- AC_SUBST([AVILIB_CXXFLAGS]) m4trace:configure.in:14: -1- AC_SUBST([AVILIB_LIBS]) m4trace:configure.in:15: -1- AC_SUBST([DEBUG_CFLAGS]) m4trace:configure.in:16: -1- AC_SUBST([PROFILING_CFLAGS]) m4trace:configure.in:16: -1- AC_SUBST([PROFILING_LIBS]) m4trace:configure.in:23: -2- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDVDREAD]) m4trace:configure.in:23: -1- AC_CHECK_LIB([dvdread], [DVDOpen], [DVDREAD_CFLAGS="-I$with_dvdread_i -I/usr/local/include" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread -lm" AC_DEFINE(HAVE_LIBDVDREAD) have_dvdread=yes], [have_dvdread=no], [-L$with_dvdread_l -ldvdread -lm]) m4trace:configure.in:23: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDVDREAD]) m4trace:configure.in:23: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [autoconf/general.m4:2315: AC_CHECK_FILE is expanded from... aclocal.m4:347: AM_PATH_LIBDVDREAD is expanded from... configure.in:23: the top level]) m4trace:configure.in:23: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDVDREAD_INC]) m4trace:configure.in:23: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [autoconf/general.m4:2315: AC_CHECK_FILE is expanded from... aclocal.m4:347: AM_PATH_LIBDVDREAD is expanded from... configure.in:23: the top level]) m4trace:configure.in:23: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDVDREAD_INC]) m4trace:configure.in:23: -1- _m4_warn([cross], [cannot check for file existence when cross compiling], [autoconf/general.m4:2315: AC_CHECK_FILE is expanded from... aclocal.m4:347: AM_PATH_LIBDVDREAD is expanded from... configure.in:23: the top level]) m4trace:configure.in:23: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDVDREAD]) m4trace:configure.in:23: -1- AC_SUBST([DVDREAD_CFLAGS]) m4trace:configure.in:23: -1- AC_SUBST([DVDREAD_LIBS]) m4trace:configure.in:24: -1- AM_CONDITIONAL([HAVE_LIBDVDREAD], [test x"$have_dvdread" = "xyes"]) m4trace:configure.in:24: -1- AC_SUBST([HAVE_LIBDVDREAD_TRUE]) m4trace:configure.in:24: -1- AC_SUBST([HAVE_LIBDVDREAD_FALSE]) m4trace:configure.in:26: -1- AC_CHECK_FUNCS([fseeko]) m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_FSEEKO], [/* Define to 1 if you have the `fseeko\' function. */ #undef HAVE_FSEEKO]) m4trace:configure.in:28: -1- AC_DEFINE_TRACE_LITERAL([NEED_FSEEKO]) m4trace:configure.in:32: -1- AC_HEADER_STDC([]) m4trace:configure.in:32: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) m4trace:configure.in:32: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS]) m4trace:configure.in:37: -1- AC_CONFIG_FILES([Makefile avilib/Makefile]) m4trace:configure.in:37: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. You should run autoupdate.], []) m4trace:configure.in:37: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) m4trace:configure.in:37: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) m4trace:configure.in:37: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally.], []) m4trace:configure.in:37: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally.], []) m4trace:configure.in:37: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me:$LINENO: error: conditional \"HAVE_LIBDVDREAD\" was never defined. Usually this means the macro was only invoked conditionally.], []) m4trace:configure.in:37: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me: error: conditional \"HAVE_LIBDVDREAD\" was never defined. Usually this means the macro was only invoked conditionally.], []) ogmtools-1.5/autom4te.cache/output.00000644000076400234220000052427710143371302017112 0ustar mosuvj00000000000000@%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. @%:@ Generated by GNU Autoconf 2.59. @%:@ @%:@ Copyright (C) 2003 Free Software Foundation, Inc. @%:@ This configure script is free software; the Free Software Foundation @%:@ gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="ogmmerge.cpp" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE CPP EGREP RANLIB ac_ct_RANLIB OGG_CFLAGS OGG_LIBS VORBIS_CFLAGS VORBIS_LIBS VORBISFILE_LIBS VORBISENC_LIBS AVILIB_CFLAGS AVILIB_CXXFLAGS AVILIB_LIBS DEBUG_CFLAGS PROFILING_CFLAGS PROFILING_LIBS DVDREAD_CFLAGS DVDREAD_LIBS HAVE_LIBDVDREAD_TRUE HAVE_LIBDVDREAD_FALSE LIB@&t@OBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors --disable-oggtest Do not try to compile and run a test Ogg program --disable-vorbistest Do not try to compile and run a test Vorbis program --enable-debug compile with debug information --enable-profiling compile with profiling information Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ogg-prefix=PFX Prefix where libogg is installed (optional) --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional) --with-dvdread use installed libdvdread library (default=yes) --with-dvdread-includes=PFX prefix where local dvdread includes are installed (optional) --with-dvdread-libs=PFX prefix where local dvdread lib is installed (optional) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME @%:@@%:@ --------- @%:@@%:@ @%:@@%:@ Platform. @%:@@%:@ @%:@@%:@ --------- @%:@@%:@ hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF @%:@@%:@ ----------- @%:@@%:@ @%:@@%:@ Core tests. @%:@@%:@ @%:@@%:@ ----------- @%:@@%:@ _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX @%:@@%:@ ---------------- @%:@@%:@ @%:@@%:@ Cache variables. @%:@@%:@ @%:@@%:@ ---------------- @%:@@%:@ _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX @%:@@%:@ ----------------- @%:@@%:@ @%:@@%:@ Output variables. @%:@@%:@ @%:@@%:@ ----------------- @%:@@%:@ _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX @%:@@%:@ ------------- @%:@@%:@ @%:@@%:@ Output files. @%:@@%:@ @%:@@%:@ ------------- @%:@@%:@ _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX @%:@@%:@ ----------- @%:@@%:@ @%:@@%:@ confdefs.h. @%:@@%:@ @%:@@%:@ ----------- @%:@@%:@ _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.6" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # Define the identity of the package. PACKAGE=ogmtools VERSION=1.5 cat >>confdefs.h <<_ACEOF @%:@define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF @%:@define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $@%:@ != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF @%:@ifndef __cplusplus choke me @%:@endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration @%:@include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration @%:@include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CXX_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @%:@else @%:@ include @%:@endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ @%:@include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Check whether --with-ogg-prefix or --without-ogg-prefix was given. if test "${with_ogg_prefix+set}" = set; then withval="$with_ogg_prefix" ogg_prefix="$withval" else ogg_prefix="" fi; # Check whether --enable-oggtest or --disable-oggtest was given. if test "${enable_oggtest+set}" = set; then enableval="$enable_oggtest" else enable_oggtest=yes fi; if test "x$ogg_prefix" != "x"; then ogg_args="$ogg_args --prefix=$ogg_prefix" OGG_CFLAGS="-I$ogg_prefix/include" OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE"; then ogg_args="$ogg_args --prefix=$prefix" OGG_CFLAGS="-I$prefix/include" OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" echo "$as_me:$LINENO: checking for Ogg" >&5 echo $ECHO_N "checking for Ogg... $ECHO_C" >&6 no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" rm -f conf.oggtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_ogg=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" : fi rm -f conf.oggtest # Check whether --with-vorbis-prefix or --without-vorbis-prefix was given. if test "${with_vorbis_prefix+set}" = set; then withval="$with_vorbis_prefix" vorbis_prefix="$withval" else vorbis_prefix="" fi; # Check whether --enable-vorbistest or --disable-vorbistest was given. if test "${enable_vorbistest+set}" = set; then enableval="$enable_vorbistest" else enable_vorbistest=yes fi; if test "x$vorbis_prefix" != "x" ; then vorbis_args="$vorbis_args --prefix=$vorbis_prefix" VORBIS_CFLAGS="-I$vorbis_prefix/include" VORBIS_LIBDIR="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then vorbis_args="$vorbis_args --prefix=$prefix" VORBIS_CFLAGS="-I$prefix/include" VORBIS_LIBDIR="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" echo "$as_me:$LINENO: checking for Vorbis" >&5 echo $ECHO_N "checking for Vorbis... $ECHO_C" >&6 no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" rm -f conf.vorbistest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_vorbis=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" : fi rm -f conf.vorbistest AVILIB_CFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_CXXFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_LIBS="-Lavilib -lavi" # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" fi; if test x"$enable_debug" = x"yes"; then DEBUG_CFLAGS="-g -DDEBUG" else DEBUG_CFLAGS="" fi # Check whether --enable-profiling or --disable-profiling was given. if test "${enable_profiling+set}" = set; then enableval="$enable_profiling" fi; if test x"$enable_profiling" = x"yes"; then PROFILING_CFLAGS="-pg" PROFILING_LIBS="-lc_p" else PROFILING_CFLAGS="" PROFILING_LIBS="" fi have_dvdread=no # Check whether --with-dvdread or --without-dvdread was given. if test "${with_dvdread+set}" = set; then withval="$with_dvdread" case "${withval}" in yes) with_dvdread=yes;; no) with_dvdread=no ;; *) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-dvdread" >&5 echo "$as_me: error: bad value ${withval} for --with-dvdread" >&2;} { (exit 1); exit 1; }; } ;; esac else with_dvdread=yes fi; # Check whether --with-dvdread-includes or --without-dvdread-includes was given. if test "${with_dvdread_includes+set}" = set; then withval="$with_dvdread_includes" dvdread_includes="$withval" else dvdread_includes="" fi; # Check whether --with-dvdread-libs or --without-dvdread-libs was given. if test "${with_dvdread_libs+set}" = set; then withval="$with_dvdread_libs" dvdread_libs="$withval" else dvdread_libs="" fi; DVDREAD_LIBS="" DVDREAD_CFLAGS="" have_dvdread=no if test x$with_dvdread = "x"yes ; then if test x$dvdread_includes != "x" ; then with_dvdread_i="$dvdread_includes/include" else with_dvdread_i="/usr/include" fi if test x$dvdread_libs != x ; then with_dvdread_l="$dvdread_libs/lib" else with_dvdread_l="/usr/lib" fi echo "$as_me:$LINENO: checking for DVDOpen in -ldvdread" >&5 echo $ECHO_N "checking for DVDOpen in -ldvdread... $ECHO_C" >&6 if test "${ac_cv_lib_dvdread_DVDOpen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldvdread -L$with_dvdread_l -ldvdread -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char DVDOpen (); int main () { DVDOpen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dvdread_DVDOpen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dvdread_DVDOpen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dvdread_DVDOpen" >&5 echo "${ECHO_T}$ac_cv_lib_dvdread_DVDOpen" >&6 if test $ac_cv_lib_dvdread_DVDOpen = yes; then DVDREAD_CFLAGS="-I$with_dvdread_i -I/usr/local/include" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread -lm" cat >>confdefs.h <<\_ACEOF @%:@define HAVE_LIBDVDREAD 1 _ACEOF have_dvdread=yes else have_dvdread=no fi as_ac_File=`echo "ac_cv_file_$with_dvdread_i/dvdread/dvd_reader.h" | $as_tr_sh` echo "$as_me:$LINENO: checking for $with_dvdread_i/dvdread/dvd_reader.h" >&5 echo $ECHO_N "checking for $with_dvdread_i/dvdread/dvd_reader.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_File+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$with_dvdread_i/dvdread/dvd_reader.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6 if test `eval echo '${'$as_ac_File'}'` = yes; then cat >>confdefs.h <<\_ACEOF @%:@define HAVE_LIBDVDREAD_INC 1 _ACEOF dvdread_inc=yes fi if test x"$dvdread_inc" != xyes; then echo "$as_me:$LINENO: checking for /usr/local/include/dvdread/dvd_reader.h" >&5 echo $ECHO_N "checking for /usr/local/include/dvdread/dvd_reader.h... $ECHO_C" >&6 if test "${ac_cv_file__usr_local_include_dvdread_dvd_reader_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "/usr/local/include/dvdread/dvd_reader.h"; then ac_cv_file__usr_local_include_dvdread_dvd_reader_h=yes else ac_cv_file__usr_local_include_dvdread_dvd_reader_h=no fi fi echo "$as_me:$LINENO: result: $ac_cv_file__usr_local_include_dvdread_dvd_reader_h" >&5 echo "${ECHO_T}$ac_cv_file__usr_local_include_dvdread_dvd_reader_h" >&6 if test $ac_cv_file__usr_local_include_dvdread_dvd_reader_h = yes; then cat >>confdefs.h <<\_ACEOF @%:@define HAVE_LIBDVDREAD_INC 1 _ACEOF dvdread_inc=yes fi fi if test x"$have_dvdread" != "xyes"; then with_dvdread_i="../dvdread" with_dvdread_l="../dvdread" echo "$as_me:$LINENO: checking for ./dvdread/dvd_reader.h" >&5 echo $ECHO_N "checking for ./dvdread/dvd_reader.h... $ECHO_C" >&6 if test "${ac_cv_file___dvdread_dvd_reader_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "./dvdread/dvd_reader.h"; then ac_cv_file___dvdread_dvd_reader_h=yes else ac_cv_file___dvdread_dvd_reader_h=no fi fi echo "$as_me:$LINENO: result: $ac_cv_file___dvdread_dvd_reader_h" >&5 echo "${ECHO_T}$ac_cv_file___dvdread_dvd_reader_h" >&6 if test $ac_cv_file___dvdread_dvd_reader_h = yes; then cat >>confdefs.h <<\_ACEOF @%:@define HAVE_LIBDVDREAD 1 _ACEOF have_dvdread=yes DVDREAD_CFLAGS="-I$with_dvdread_i" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread_tc" else have_dvdread=no fi fi if test x"$have_dvdread" != "xyes"; then echo '***********************************' echo 'libdvdread not found. dvdxchap will' echo 'not be compiled.' echo '***********************************' fi fi if test x"$have_dvdread" = "xyes"; then HAVE_LIBDVDREAD_TRUE= HAVE_LIBDVDREAD_FALSE='#' else HAVE_LIBDVDREAD_TRUE='#' HAVE_LIBDVDREAD_FALSE= fi for ac_func in fseeko do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF @%:@define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test x${ac_cv_func_fseeko} != xyes; then cat >>confdefs.h <<\_ACEOF @%:@define NEED_FSEEKO 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF @%:@define STDC_HEADERS 1 _ACEOF fi CFLAGS="-Wall -Wno-sign-compare @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AVILIB_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@" CXXFLAGS="-Wall -Wno-sign-compare @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AVILIB_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@" ac_config_files="$ac_config_files Makefile avilib/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIB@&t@OBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_LIBDVDREAD_TRUE}" && test -z "${HAVE_LIBDVDREAD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_LIBDVDREAD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_LIBDVDREAD\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX @%:@@%:@ Running $as_me. @%:@@%:@ _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "avilib/Makefile" ) CONFIG_FILES="$CONFIG_FILES avilib/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@OGG_CFLAGS@,$OGG_CFLAGS,;t t s,@OGG_LIBS@,$OGG_LIBS,;t t s,@VORBIS_CFLAGS@,$VORBIS_CFLAGS,;t t s,@VORBIS_LIBS@,$VORBIS_LIBS,;t t s,@VORBISFILE_LIBS@,$VORBISFILE_LIBS,;t t s,@VORBISENC_LIBS@,$VORBISENC_LIBS,;t t s,@AVILIB_CFLAGS@,$AVILIB_CFLAGS,;t t s,@AVILIB_CXXFLAGS@,$AVILIB_CXXFLAGS,;t t s,@AVILIB_LIBS@,$AVILIB_LIBS,;t t s,@DEBUG_CFLAGS@,$DEBUG_CFLAGS,;t t s,@PROFILING_CFLAGS@,$PROFILING_CFLAGS,;t t s,@PROFILING_LIBS@,$PROFILING_LIBS,;t t s,@DVDREAD_CFLAGS@,$DVDREAD_CFLAGS,;t t s,@DVDREAD_LIBS@,$DVDREAD_LIBS,;t t s,@HAVE_LIBDVDREAD_TRUE@,$HAVE_LIBDVDREAD_TRUE,;t t s,@HAVE_LIBDVDREAD_FALSE@,$HAVE_LIBDVDREAD_FALSE,;t t s,@LIB@&t@OBJS@,$LIB@&t@OBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ @%:@]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi ogmtools-1.5/configure0000755000076400234220000052325010143371302014562 0ustar mosuvj00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="ogmmerge.cpp" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE CPP EGREP RANLIB ac_ct_RANLIB OGG_CFLAGS OGG_LIBS VORBIS_CFLAGS VORBIS_LIBS VORBISFILE_LIBS VORBISENC_LIBS AVILIB_CFLAGS AVILIB_CXXFLAGS AVILIB_LIBS DEBUG_CFLAGS PROFILING_CFLAGS PROFILING_LIBS DVDREAD_CFLAGS DVDREAD_LIBS HAVE_LIBDVDREAD_TRUE HAVE_LIBDVDREAD_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors --disable-oggtest Do not try to compile and run a test Ogg program --disable-vorbistest Do not try to compile and run a test Vorbis program --enable-debug compile with debug information --enable-profiling compile with profiling information Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ogg-prefix=PFX Prefix where libogg is installed (optional) --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional) --with-dvdread use installed libdvdread library (default=yes) --with-dvdread-includes=PFX prefix where local dvdread includes are installed (optional) --with-dvdread-libs=PFX prefix where local dvdread lib is installed (optional) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.6" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # Define the identity of the package. PACKAGE=ogmtools VERSION=1.5 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CXX_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Check whether --with-ogg-prefix or --without-ogg-prefix was given. if test "${with_ogg_prefix+set}" = set; then withval="$with_ogg_prefix" ogg_prefix="$withval" else ogg_prefix="" fi; # Check whether --enable-oggtest or --disable-oggtest was given. if test "${enable_oggtest+set}" = set; then enableval="$enable_oggtest" else enable_oggtest=yes fi; if test "x$ogg_prefix" != "x"; then ogg_args="$ogg_args --prefix=$ogg_prefix" OGG_CFLAGS="-I$ogg_prefix/include" OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE"; then ogg_args="$ogg_args --prefix=$prefix" OGG_CFLAGS="-I$prefix/include" OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" echo "$as_me:$LINENO: checking for Ogg" >&5 echo $ECHO_N "checking for Ogg... $ECHO_C" >&6 no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" rm -f conf.oggtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_ogg=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" : fi rm -f conf.oggtest # Check whether --with-vorbis-prefix or --without-vorbis-prefix was given. if test "${with_vorbis_prefix+set}" = set; then withval="$with_vorbis_prefix" vorbis_prefix="$withval" else vorbis_prefix="" fi; # Check whether --enable-vorbistest or --disable-vorbistest was given. if test "${enable_vorbistest+set}" = set; then enableval="$enable_vorbistest" else enable_vorbistest=yes fi; if test "x$vorbis_prefix" != "x" ; then vorbis_args="$vorbis_args --prefix=$vorbis_prefix" VORBIS_CFLAGS="-I$vorbis_prefix/include" VORBIS_LIBDIR="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then vorbis_args="$vorbis_args --prefix=$prefix" VORBIS_CFLAGS="-I$prefix/include" VORBIS_LIBDIR="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" echo "$as_me:$LINENO: checking for Vorbis" >&5 echo $ECHO_N "checking for Vorbis... $ECHO_C" >&6 no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" rm -f conf.vorbistest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_vorbis=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" : fi rm -f conf.vorbistest AVILIB_CFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_CXXFLAGS="-Iavilib -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AVILIB_LIBS="-Lavilib -lavi" # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" fi; if test x"$enable_debug" = x"yes"; then DEBUG_CFLAGS="-g -DDEBUG" else DEBUG_CFLAGS="" fi # Check whether --enable-profiling or --disable-profiling was given. if test "${enable_profiling+set}" = set; then enableval="$enable_profiling" fi; if test x"$enable_profiling" = x"yes"; then PROFILING_CFLAGS="-pg" PROFILING_LIBS="-lc_p" else PROFILING_CFLAGS="" PROFILING_LIBS="" fi have_dvdread=no # Check whether --with-dvdread or --without-dvdread was given. if test "${with_dvdread+set}" = set; then withval="$with_dvdread" case "${withval}" in yes) with_dvdread=yes;; no) with_dvdread=no ;; *) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-dvdread" >&5 echo "$as_me: error: bad value ${withval} for --with-dvdread" >&2;} { (exit 1); exit 1; }; } ;; esac else with_dvdread=yes fi; # Check whether --with-dvdread-includes or --without-dvdread-includes was given. if test "${with_dvdread_includes+set}" = set; then withval="$with_dvdread_includes" dvdread_includes="$withval" else dvdread_includes="" fi; # Check whether --with-dvdread-libs or --without-dvdread-libs was given. if test "${with_dvdread_libs+set}" = set; then withval="$with_dvdread_libs" dvdread_libs="$withval" else dvdread_libs="" fi; DVDREAD_LIBS="" DVDREAD_CFLAGS="" have_dvdread=no if test x$with_dvdread = "x"yes ; then if test x$dvdread_includes != "x" ; then with_dvdread_i="$dvdread_includes/include" else with_dvdread_i="/usr/include" fi if test x$dvdread_libs != x ; then with_dvdread_l="$dvdread_libs/lib" else with_dvdread_l="/usr/lib" fi echo "$as_me:$LINENO: checking for DVDOpen in -ldvdread" >&5 echo $ECHO_N "checking for DVDOpen in -ldvdread... $ECHO_C" >&6 if test "${ac_cv_lib_dvdread_DVDOpen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldvdread -L$with_dvdread_l -ldvdread -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char DVDOpen (); int main () { DVDOpen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dvdread_DVDOpen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dvdread_DVDOpen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dvdread_DVDOpen" >&5 echo "${ECHO_T}$ac_cv_lib_dvdread_DVDOpen" >&6 if test $ac_cv_lib_dvdread_DVDOpen = yes; then DVDREAD_CFLAGS="-I$with_dvdread_i -I/usr/local/include" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread -lm" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBDVDREAD 1 _ACEOF have_dvdread=yes else have_dvdread=no fi as_ac_File=`echo "ac_cv_file_$with_dvdread_i/dvdread/dvd_reader.h" | $as_tr_sh` echo "$as_me:$LINENO: checking for $with_dvdread_i/dvdread/dvd_reader.h" >&5 echo $ECHO_N "checking for $with_dvdread_i/dvdread/dvd_reader.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_File+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$with_dvdread_i/dvdread/dvd_reader.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6 if test `eval echo '${'$as_ac_File'}'` = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIBDVDREAD_INC 1 _ACEOF dvdread_inc=yes fi if test x"$dvdread_inc" != xyes; then echo "$as_me:$LINENO: checking for /usr/local/include/dvdread/dvd_reader.h" >&5 echo $ECHO_N "checking for /usr/local/include/dvdread/dvd_reader.h... $ECHO_C" >&6 if test "${ac_cv_file__usr_local_include_dvdread_dvd_reader_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "/usr/local/include/dvdread/dvd_reader.h"; then ac_cv_file__usr_local_include_dvdread_dvd_reader_h=yes else ac_cv_file__usr_local_include_dvdread_dvd_reader_h=no fi fi echo "$as_me:$LINENO: result: $ac_cv_file__usr_local_include_dvdread_dvd_reader_h" >&5 echo "${ECHO_T}$ac_cv_file__usr_local_include_dvdread_dvd_reader_h" >&6 if test $ac_cv_file__usr_local_include_dvdread_dvd_reader_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIBDVDREAD_INC 1 _ACEOF dvdread_inc=yes fi fi if test x"$have_dvdread" != "xyes"; then with_dvdread_i="../dvdread" with_dvdread_l="../dvdread" echo "$as_me:$LINENO: checking for ./dvdread/dvd_reader.h" >&5 echo $ECHO_N "checking for ./dvdread/dvd_reader.h... $ECHO_C" >&6 if test "${ac_cv_file___dvdread_dvd_reader_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "./dvdread/dvd_reader.h"; then ac_cv_file___dvdread_dvd_reader_h=yes else ac_cv_file___dvdread_dvd_reader_h=no fi fi echo "$as_me:$LINENO: result: $ac_cv_file___dvdread_dvd_reader_h" >&5 echo "${ECHO_T}$ac_cv_file___dvdread_dvd_reader_h" >&6 if test $ac_cv_file___dvdread_dvd_reader_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIBDVDREAD 1 _ACEOF have_dvdread=yes DVDREAD_CFLAGS="-I$with_dvdread_i" DVDREAD_LIBS="-L$with_dvdread_l -ldvdread_tc" else have_dvdread=no fi fi if test x"$have_dvdread" != "xyes"; then echo '***********************************' echo 'libdvdread not found. dvdxchap will' echo 'not be compiled.' echo '***********************************' fi fi if test x"$have_dvdread" = "xyes"; then HAVE_LIBDVDREAD_TRUE= HAVE_LIBDVDREAD_FALSE='#' else HAVE_LIBDVDREAD_TRUE='#' HAVE_LIBDVDREAD_FALSE= fi for ac_func in fseeko do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test x${ac_cv_func_fseeko} != xyes; then cat >>confdefs.h <<\_ACEOF #define NEED_FSEEKO 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi CFLAGS="-Wall -Wno-sign-compare @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AVILIB_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@" CXXFLAGS="-Wall -Wno-sign-compare @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AVILIB_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@" ac_config_files="$ac_config_files Makefile avilib/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_LIBDVDREAD_TRUE}" && test -z "${HAVE_LIBDVDREAD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_LIBDVDREAD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_LIBDVDREAD\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "avilib/Makefile" ) CONFIG_FILES="$CONFIG_FILES avilib/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@OGG_CFLAGS@,$OGG_CFLAGS,;t t s,@OGG_LIBS@,$OGG_LIBS,;t t s,@VORBIS_CFLAGS@,$VORBIS_CFLAGS,;t t s,@VORBIS_LIBS@,$VORBIS_LIBS,;t t s,@VORBISFILE_LIBS@,$VORBISFILE_LIBS,;t t s,@VORBISENC_LIBS@,$VORBISENC_LIBS,;t t s,@AVILIB_CFLAGS@,$AVILIB_CFLAGS,;t t s,@AVILIB_CXXFLAGS@,$AVILIB_CXXFLAGS,;t t s,@AVILIB_LIBS@,$AVILIB_LIBS,;t t s,@DEBUG_CFLAGS@,$DEBUG_CFLAGS,;t t s,@PROFILING_CFLAGS@,$PROFILING_CFLAGS,;t t s,@PROFILING_LIBS@,$PROFILING_LIBS,;t t s,@DVDREAD_CFLAGS@,$DVDREAD_CFLAGS,;t t s,@DVDREAD_LIBS@,$DVDREAD_LIBS,;t t s,@HAVE_LIBDVDREAD_TRUE@,$HAVE_LIBDVDREAD_TRUE,;t t s,@HAVE_LIBDVDREAD_FALSE@,$HAVE_LIBDVDREAD_FALSE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi ogmtools-1.5/install-sh0000755000076400234220000001435010143371302014653 0ustar mosuvj00000000000000#!/bin/sh # # install - install a program, script, or datafile # # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 ogmtools-1.5/mkinstalldirs0000755000076400234220000000341110143371302015451 0ustar mosuvj00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) # -h for help echo "${usage}" 1>&2; exit 0 ;; -m ) # -m PERM arg shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } dirmode="${1}" shift ;; -- ) shift; break ;; # stop option processing -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option * ) break ;; # first non-opt arg esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 3 # End: # mkinstalldirs ends here ogmtools-1.5/missing0000755000076400234220000002403610143371302014250 0ustar mosuvj00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 ogmtools-1.5/Makefile.in0000644000076400234220000006245210143371303014723 0ustar mosuvj00000000000000# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AVILIB_CFLAGS = @AVILIB_CFLAGS@ AVILIB_CXXFLAGS = @AVILIB_CXXFLAGS@ AVILIB_LIBS = @AVILIB_LIBS@ AWK = @AWK@ CC = @CC@ CPP = @CPP@ CXX = @CXX@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEPDIR = @DEPDIR@ DVDREAD_CFLAGS = @DVDREAD_CFLAGS@ DVDREAD_LIBS = @DVDREAD_LIBS@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ PROFILING_LIBS = @PROFILING_LIBS@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = dist-zip foreign SUBDIRS = avilib @HAVE_LIBDVDREAD_TRUE@DVDXCHAP = dvdxchap @HAVE_LIBDVDREAD_TRUE@DVDXCHAP_MAN = dvdxchap.1 @HAVE_LIBDVDREAD_TRUE@INCLUDES = $(DVDREAD_CFLAGS) bin_PROGRAMS = ogmmerge ogmdemux ogminfo ogmsplit ogmcat $(DVDXCHAP) ogmmerge_SOURCES = ogmmerge.cpp ogmmerge.h ogmstreams.h \ r_avi.cpp r_avi.h \ r_ogm.cpp r_ogm.h \ r_ac3.cpp r_ac3.h \ r_mp3.cpp r_mp3.h \ r_wav.cpp r_wav.h \ r_microdvd.cpp r_microdvd.h \ r_srt.cpp r_srt.h \ r_vobsub.cpp r_vobsub.h \ p_video.cpp p_video.h \ p_index.cpp p_index.h \ p_ac3.cpp p_ac3.h \ p_mp3.cpp p_mp3.h \ p_pcm.cpp p_pcm.h \ p_vorbis.cpp p_vorbis.h \ p_textsubs.cpp p_textsubs.h \ p_vobsub.cpp p_vobsub.h \ ac3_common.c ac3_common.h \ mp3_common.c mp3_common.h \ subtitles.cpp subtitles.h \ queue.cpp queue.h \ vorbis_header_utils.c vorbis_header_utils.h \ generic.cpp generic.h \ common.c common.h ogmmerge_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @VORBISENC_LIBS@ @AVILIB_LIBS@ \ @PROFILING_LIBS@ ogmdemux_SOURCES = ogmdemux.c ogmstreams.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogmdemux_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @AVILIB_LIBS@ @PROFILING_LIBS@ ogminfo_SOURCES = ogminfo.c ogmstreams.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogminfo_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @PROFILING_LIBS@ ogmsplit_SOURCES = ogmsplit.cpp \ queue.cpp queue.h \ ogmmerge.h ogmstreams.h \ generic.cpp generic.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogmsplit_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @PROFILING_LIBS@ ogmcat_SOURCES = ogmcat.cpp \ queue.cpp queue.h \ ogmmerge.h ogmstreams.h \ generic.cpp generic.h \ vorbis_header_utils.c vorbis_header_utils.h \ common.c common.h ogmcat_LDADD = @OGG_LIBS@ @VORBIS_LIBS@ @PROFILING_LIBS@ dvdxchap_SOURCES = dvdxchap.c dvdxchap_LDADD = @DVDREAD_LIBS@ man_MANS = ogmsplit.1 ogminfo.1 ogmmerge.1 ogmdemux.1 ogmcat.1 $(DVDXCHAP_MAN) EXTRA_DIST = $(man_MANS) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = @HAVE_LIBDVDREAD_TRUE@bin_PROGRAMS = ogmmerge$(EXEEXT) ogmdemux$(EXEEXT) \ @HAVE_LIBDVDREAD_TRUE@ ogminfo$(EXEEXT) ogmsplit$(EXEEXT) \ @HAVE_LIBDVDREAD_TRUE@ ogmcat$(EXEEXT) dvdxchap$(EXEEXT) @HAVE_LIBDVDREAD_FALSE@bin_PROGRAMS = ogmmerge$(EXEEXT) \ @HAVE_LIBDVDREAD_FALSE@ ogmdemux$(EXEEXT) ogminfo$(EXEEXT) \ @HAVE_LIBDVDREAD_FALSE@ ogmsplit$(EXEEXT) ogmcat$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_dvdxchap_OBJECTS = dvdxchap.$(OBJEXT) dvdxchap_OBJECTS = $(am_dvdxchap_OBJECTS) dvdxchap_DEPENDENCIES = dvdxchap_LDFLAGS = am_ogmcat_OBJECTS = ogmcat.$(OBJEXT) queue.$(OBJEXT) generic.$(OBJEXT) \ vorbis_header_utils.$(OBJEXT) common.$(OBJEXT) ogmcat_OBJECTS = $(am_ogmcat_OBJECTS) ogmcat_DEPENDENCIES = ogmcat_LDFLAGS = am_ogmdemux_OBJECTS = ogmdemux.$(OBJEXT) vorbis_header_utils.$(OBJEXT) \ common.$(OBJEXT) ogmdemux_OBJECTS = $(am_ogmdemux_OBJECTS) ogmdemux_DEPENDENCIES = ogmdemux_LDFLAGS = am_ogminfo_OBJECTS = ogminfo.$(OBJEXT) vorbis_header_utils.$(OBJEXT) \ common.$(OBJEXT) ogminfo_OBJECTS = $(am_ogminfo_OBJECTS) ogminfo_DEPENDENCIES = ogminfo_LDFLAGS = am_ogmmerge_OBJECTS = ogmmerge.$(OBJEXT) r_avi.$(OBJEXT) r_ogm.$(OBJEXT) \ r_ac3.$(OBJEXT) r_mp3.$(OBJEXT) r_wav.$(OBJEXT) \ r_microdvd.$(OBJEXT) r_srt.$(OBJEXT) r_vobsub.$(OBJEXT) \ p_video.$(OBJEXT) p_index.$(OBJEXT) p_ac3.$(OBJEXT) \ p_mp3.$(OBJEXT) p_pcm.$(OBJEXT) p_vorbis.$(OBJEXT) \ p_textsubs.$(OBJEXT) p_vobsub.$(OBJEXT) ac3_common.$(OBJEXT) \ mp3_common.$(OBJEXT) subtitles.$(OBJEXT) queue.$(OBJEXT) \ vorbis_header_utils.$(OBJEXT) generic.$(OBJEXT) \ common.$(OBJEXT) ogmmerge_OBJECTS = $(am_ogmmerge_OBJECTS) ogmmerge_DEPENDENCIES = ogmmerge_LDFLAGS = am_ogmsplit_OBJECTS = ogmsplit.$(OBJEXT) queue.$(OBJEXT) \ generic.$(OBJEXT) vorbis_header_utils.$(OBJEXT) \ common.$(OBJEXT) ogmsplit_OBJECTS = $(am_ogmsplit_OBJECTS) ogmsplit_DEPENDENCIES = ogmsplit_LDFLAGS = DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ac3_common.Po ./$(DEPDIR)/common.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/dvdxchap.Po ./$(DEPDIR)/generic.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mp3_common.Po ./$(DEPDIR)/ogmcat.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ogmdemux.Po ./$(DEPDIR)/ogminfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ogmmerge.Po ./$(DEPDIR)/ogmsplit.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/p_ac3.Po ./$(DEPDIR)/p_index.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/p_mp3.Po ./$(DEPDIR)/p_pcm.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/p_textsubs.Po ./$(DEPDIR)/p_video.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/p_vobsub.Po ./$(DEPDIR)/p_vorbis.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/queue.Po ./$(DEPDIR)/r_ac3.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/r_avi.Po ./$(DEPDIR)/r_microdvd.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/r_mp3.Po ./$(DEPDIR)/r_ogm.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/r_srt.Po ./$(DEPDIR)/r_vobsub.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/r_wav.Po ./$(DEPDIR)/subtitles.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/vorbis_header_utils.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ CXXFLAGS = @CXXFLAGS@ DIST_SOURCES = $(dvdxchap_SOURCES) $(ogmcat_SOURCES) $(ogmdemux_SOURCES) \ $(ogminfo_SOURCES) $(ogmmerge_SOURCES) $(ogmsplit_SOURCES) NROFF = nroff MANS = $(man_MANS) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README COPYING ChangeLog INSTALL Makefile.am Makefile.in \ TODO acinclude.m4 aclocal.m4 config.guess config.sub configure \ configure.in depcomp install-sh missing mkinstalldirs DIST_SUBDIRS = $(SUBDIRS) SOURCES = $(dvdxchap_SOURCES) $(ogmcat_SOURCES) $(ogmdemux_SOURCES) $(ogminfo_SOURCES) $(ogmmerge_SOURCES) $(ogmsplit_SOURCES) all: all-recursive .SUFFIXES: .SUFFIXES: .c .cpp .o .obj am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) dvdxchap$(EXEEXT): $(dvdxchap_OBJECTS) $(dvdxchap_DEPENDENCIES) @rm -f dvdxchap$(EXEEXT) $(LINK) $(dvdxchap_LDFLAGS) $(dvdxchap_OBJECTS) $(dvdxchap_LDADD) $(LIBS) ogmcat$(EXEEXT): $(ogmcat_OBJECTS) $(ogmcat_DEPENDENCIES) @rm -f ogmcat$(EXEEXT) $(CXXLINK) $(ogmcat_LDFLAGS) $(ogmcat_OBJECTS) $(ogmcat_LDADD) $(LIBS) ogmdemux$(EXEEXT): $(ogmdemux_OBJECTS) $(ogmdemux_DEPENDENCIES) @rm -f ogmdemux$(EXEEXT) $(LINK) $(ogmdemux_LDFLAGS) $(ogmdemux_OBJECTS) $(ogmdemux_LDADD) $(LIBS) ogminfo$(EXEEXT): $(ogminfo_OBJECTS) $(ogminfo_DEPENDENCIES) @rm -f ogminfo$(EXEEXT) $(LINK) $(ogminfo_LDFLAGS) $(ogminfo_OBJECTS) $(ogminfo_LDADD) $(LIBS) ogmmerge$(EXEEXT): $(ogmmerge_OBJECTS) $(ogmmerge_DEPENDENCIES) @rm -f ogmmerge$(EXEEXT) $(CXXLINK) $(ogmmerge_LDFLAGS) $(ogmmerge_OBJECTS) $(ogmmerge_LDADD) $(LIBS) ogmsplit$(EXEEXT): $(ogmsplit_OBJECTS) $(ogmsplit_DEPENDENCIES) @rm -f ogmsplit$(EXEEXT) $(CXXLINK) $(ogmsplit_LDFLAGS) $(ogmsplit_OBJECTS) $(ogmsplit_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ac3_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvdxchap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogmcat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogmdemux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogminfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogmmerge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogmsplit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_ac3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_index.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_mp3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_pcm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_textsubs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_video.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_vobsub.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_vorbis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_ac3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_avi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_microdvd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_mp3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_ogm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_srt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_vobsub.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r_wav.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subtitles.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbis_header_utils.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ .cpp.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< .cpp.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CXXCOMPILE) -c -o $@ `cygpath -w $<` CXXDEPMODE = @CXXDEPMODE@ uninstall-info-am: man1dir = $(mandir)/man1 install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . distdir = $(PACKAGE)-$(VERSION) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ find $$dc_install_base -type f -print ; \ exit 1; } >&2 ) \ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' distcleancheck: distclean if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) $(MANS) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-man install-exec-am: install-binPROGRAMS install-info: install-info-recursive install-man: install-man1 installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf autom4te.cache maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man uninstall-info: uninstall-info-recursive uninstall-man: uninstall-man1 .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-recursive dist dist-all \ dist-gzip dist-zip distcheck distclean distclean-compile \ distclean-depend distclean-generic distclean-recursive \ distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \ info info-am info-recursive install install-am \ install-binPROGRAMS install-data install-data-am \ install-data-recursive install-exec install-exec-am \ install-exec-recursive install-info install-info-am \ install-info-recursive install-man install-man1 \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am \ uninstall-info-recursive uninstall-man uninstall-man1 \ uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: