Remove a reference to w->f_pos, and mk_seekFile().
[libmkv.git] / test / test.c
blob40aff314b691fbad6d8365e3232649f016824483
1 /*****************************************************************************
2 * test.c:
3 *****************************************************************************
4 * Copyright (C) 2007 libmkv
5 * $Id: $
7 * Authors: Nathan Caldwell
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /******************
25 * A _very_ simple matroska muxer. This is simply a test to make sure it even
26 * works.
27 ******************/
29 #include <stdio.h>
30 #include <getopt.h>
31 #include <stdlib.h>
32 #include <string.h>
34 #ifdef HAVE_STDINT_H
35 #include <stdint.h>
36 #else
37 #include <inttypes.h>
38 #endif
40 #include "libmkv.h"
43 int main( int argc, char ** argv )
45 mk_Writer * mkvfile;
46 int c, option_index = 0;
47 static char *output = NULL;
48 static char *in_video = NULL;
49 static char *in_audio = NULL;
51 for( ;; )
53 static struct option long_options[] =
55 { "help", no_argument, NULL, 'h' },
56 { "output", required_argument, NULL, 'o' },
57 { "audio", required_argument, NULL, 'a' },
58 { "video", required_argument, NULL, 'v' },
59 { 0, 0, 0, 0 }
62 c = getopt_long( argc, argv,
63 "ho:a:v:",
64 long_options, &option_index );
65 if( c < 0 )
67 break;
70 switch( c )
72 case 'o':
73 printf("Got output filename: %s\n", optarg);
74 output = strdup( optarg );
75 break;
76 case 'v':
77 printf("Got input video track: %s\n", optarg);
78 in_video = strdup( optarg );
79 break;
80 case 'a':
81 printf("Got input audio track: %s\n", optarg);
82 in_audio = strdup( optarg );
83 break;
84 default:
85 fprintf( stderr, "Unknown option (%s)\n", argv[optind] );
86 case 'h':
87 show_help(argv);
88 return 1;
92 mkvfile = mk_createWriter( output );
94 mk_writeHeader(mkvfile, "test.c",
95 MKV_CODEC_X264,
96 codecPrivate, sizeof( codecPrivate ),
97 default_frame_duration,
98 timescale,
99 width, height,
100 d_width, d_height );
102 mk_close( mkvfile );
104 free( output );
105 free( in_video );
106 free( in_audio );
108 return 0;
111 show_help(char ** argv)
113 fprintf(stderr, "%s [options] -o output_file.mkv video_track audio_track\n", argv[0]);
114 fprintf(stderr, "\t-h, --help\t\tPrint this message, then quit.\n");
115 fprintf(stderr, "\t-o, --output\t\tSpecify the output file.*\n");
116 fprintf(stderr, "\t\t* - Required argument.\n");