annotate libmpdemux/muxer.c @ 15148:067f10ad6538

New section: "menc-feat-dvd-mpeg4-muxing" about how to mux a video obtained with MEncoder into different containers. Based on Rich's guide and some tips by Nico Sabi. Reviewed by The Wanderer, Dominik 'Rathann' Mierzejewski and Diego Biurrun
author gpoirier
date Wed, 13 Apr 2005 18:53:30 +0000
parents 7a2adc5e8928
children 7b0599d9614a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
1
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
2 #include <stdio.h>
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
3 #include <stdlib.h>
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
4 #include <string.h>
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
5 #include <inttypes.h>
8591
35bfd508bf5f FreeBSD fix
nexus
parents: 8585
diff changeset
6 #include <unistd.h>
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
7
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
8 #include "config.h"
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
9 #include "../version.h"
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
10
12341
0db4a3a5b01d removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents: 12016
diff changeset
11 #include "aviheader.h"
0db4a3a5b01d removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents: 12016
diff changeset
12 #include "ms_hdr.h"
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
13
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
14 #include "muxer.h"
14753
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
15 #include "stream.h"
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
16 #include "demuxer.h"
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
17 #include "mp_msg.h"
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
18 #include "help_mp.h"
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
19 #include "stheader.h"
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
20
9007
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8591
diff changeset
21 muxer_t *muxer_new_muxer(int type,FILE *f){
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
22 muxer_t* muxer=malloc(sizeof(muxer_t));
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
23 memset(muxer,0,sizeof(muxer_t));
9007
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8591
diff changeset
24 muxer->file = f;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
25 switch (type) {
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
26 case MUXER_TYPE_MPEG:
14753
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
27 if(! muxer_init_muxer_mpeg(muxer))
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
28 return NULL;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
29 break;
12016
b962aaad2940 rawvideo muxer patch by John Earl <jwe21@cam.ac.uk>
ranma
parents: 9007
diff changeset
30 case MUXER_TYPE_RAWVIDEO:
14753
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
31 if(! muxer_init_muxer_rawvideo(muxer))
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
32 return NULL;
12016
b962aaad2940 rawvideo muxer patch by John Earl <jwe21@cam.ac.uk>
ranma
parents: 9007
diff changeset
33 break;
14757
7a2adc5e8928 initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents: 14753
diff changeset
34 #ifdef USE_LIBAVFORMAT
7a2adc5e8928 initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents: 14753
diff changeset
35 case MUXER_TYPE_LAVF:
7a2adc5e8928 initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents: 14753
diff changeset
36 if(! muxer_init_muxer_lavf(muxer))
7a2adc5e8928 initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents: 14753
diff changeset
37 return NULL;
7a2adc5e8928 initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents: 14753
diff changeset
38 break;
7a2adc5e8928 initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents: 14753
diff changeset
39 #endif
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
40 case MUXER_TYPE_AVI:
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
41 default:
14753
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
42 if(! muxer_init_muxer_avi(muxer))
70c446099f40 new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents: 12341
diff changeset
43 return NULL;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
44 }
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
45 return muxer;
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents:
diff changeset
46 }