comparison avienc.c @ 1169:d18cc9a1fd02 libavformat

allow individual selection of muxers and demuxers
author mru
date Mon, 10 Jul 2006 21:14:37 +0000
parents d89d7ef290da
children 6a5e58d2114b
comparison
equal deleted inserted replaced
1168:c894489e2abe 1169:d18cc9a1fd02
22 /* 22 /*
23 * TODO: 23 * TODO:
24 * - fill all fields if non streamed (nb_frames for example) 24 * - fill all fields if non streamed (nb_frames for example)
25 */ 25 */
26 26
27 #ifdef CONFIG_MUXERS 27 #ifdef CONFIG_AVI_MUXER
28 typedef struct AVIIentry { 28 typedef struct AVIIentry {
29 unsigned int flags, pos, len; 29 unsigned int flags, pos, len;
30 } AVIIentry; 30 } AVIIentry;
31 31
32 #define AVI_INDEX_CLUSTER_SIZE 16384 32 #define AVI_INDEX_CLUSTER_SIZE 16384
69 pos = url_ftell(pb); 69 pos = url_ftell(pb);
70 url_fseek(pb, start - 4, SEEK_SET); 70 url_fseek(pb, start - 4, SEEK_SET);
71 put_le32(pb, (uint32_t)(pos - start)); 71 put_le32(pb, (uint32_t)(pos - start));
72 url_fseek(pb, pos, SEEK_SET); 72 url_fseek(pb, pos, SEEK_SET);
73 } 73 }
74 #endif //CONFIG_MUXERS 74 #endif //CONFIG_AVI_MUXER
75 75
76 /* Note: when encoding, the first matching tag is used, so order is 76 /* Note: when encoding, the first matching tag is used, so order is
77 important if multiple tags possible for a given codec. */ 77 important if multiple tags possible for a given codec. */
78 const CodecTag codec_bmp_tags[] = { 78 const CodecTag codec_bmp_tags[] = {
79 { CODEC_ID_H264, MKTAG('H', '2', '6', '4') }, 79 { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
258 enum CodecID codec_get_wav_id(unsigned int tag) 258 enum CodecID codec_get_wav_id(unsigned int tag)
259 { 259 {
260 return codec_get_id(codec_wav_tags, tag); 260 return codec_get_id(codec_wav_tags, tag);
261 } 261 }
262 262
263 #ifdef CONFIG_MUXERS 263 #ifdef CONFIG_AVI_MUXER
264 /* BITMAPINFOHEADER header */ 264 /* BITMAPINFOHEADER header */
265 void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags, int for_asf) 265 void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags, int for_asf)
266 { 266 {
267 put_le32(pb, 40 + enc->extradata_size); /* size */ 267 put_le32(pb, 40 + enc->extradata_size); /* size */
268 put_le32(pb, enc->width); 268 put_le32(pb, enc->width);
760 } 760 }
761 761
762 return res; 762 return res;
763 } 763 }
764 764
765 static AVOutputFormat avi_muxer = { 765 AVOutputFormat avi_muxer = {
766 "avi", 766 "avi",
767 "avi format", 767 "avi format",
768 "video/x-msvideo", 768 "video/x-msvideo",
769 "avi", 769 "avi",
770 sizeof(AVIContext), 770 sizeof(AVIContext),
772 CODEC_ID_MPEG4, 772 CODEC_ID_MPEG4,
773 avi_write_header, 773 avi_write_header,
774 avi_write_packet, 774 avi_write_packet,
775 avi_write_trailer, 775 avi_write_trailer,
776 }; 776 };
777 777 #endif //CONFIG_AVI_MUXER
778 int avienc_init(void)
779 {
780 av_register_output_format(&avi_muxer);
781 return 0;
782 }
783 #endif //CONFIG_MUXERS