annotate ffm.c @ 2630:eb9371d9c590 libavformat

better log message
author aurel
date Thu, 18 Oct 2007 22:11:53 +0000
parents 3427d0c63a32
children d52c718e83f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1 /*
1415
3b00fb8ef8e4 replace coder/decoder file description in libavformat by muxer/demuxer
aurel
parents: 1358
diff changeset
2 * FFM (ffserver live feed) muxer and demuxer
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
3 * Copyright (c) 2001 Fabrice Bellard.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
5 * This file is part of FFmpeg.
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
6 *
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
896
edbe5c3717f9 Update licensing information: The FSF changed postal address.
diego
parents: 887
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
21 #include "avformat.h"
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
22 #include <unistd.h>
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
23
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
24 /* The FFM file is made of blocks of fixed size */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
25 #define FFM_HEADER_SIZE 14
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
26 #define PACKET_ID 0x666d
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
27
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
28 /* each packet contains frames (which can span several packets */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
29 #define FRAME_HEADER_SIZE 8
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
30 #define FLAG_KEY_FRAME 0x01
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
31
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
32 typedef struct FFMStream {
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
33 int64_t pts;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
34 } FFMStream;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
35
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
36 enum {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
37 READ_HEADER,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
38 READ_DATA,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
39 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
40
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
41 typedef struct FFMContext {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
42 /* only reading mode */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
43 offset_t write_index, file_size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
44 int read_state;
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
45 uint8_t header[FRAME_HEADER_SIZE];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
46
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
47 /* read and write */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
48 int first_packet; /* true if first packet, needed to set the discontinuity tag */
901
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
49 int first_frame_in_packet; /* true if first frame in packet, needed to know if PTS information is valid */
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
50 int packet_size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
51 int frame_offset;
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
52 int64_t pts;
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
53 uint8_t *packet_ptr, *packet_end;
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
54 uint8_t packet[FFM_PACKET_SIZE];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
55 } FFMContext;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
56
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
57 static int64_t get_pts(AVFormatContext *s, offset_t pos);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
58
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
59 /* disable pts hack for testing */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
60 int ffm_nopts = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
61
858
66cc656ea404 Replace CONFIG_ENCODERS/CONFIG_DECODERS with CONFIG_MUXERS/CONFIG_DEMUXERS
diego
parents: 823
diff changeset
62 #ifdef CONFIG_MUXERS
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
63 static void flush_packet(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
64 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
65 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
66 int fill_size, h;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
67 ByteIOContext *pb = &s->pb;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
68
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
69 fill_size = ffm->packet_end - ffm->packet_ptr;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
70 memset(ffm->packet_ptr, 0, fill_size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
71
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
72 if (url_ftell(pb) % ffm->packet_size)
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
73 av_abort();
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
74
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
75 /* put header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
76 put_be16(pb, PACKET_ID);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
77 put_be16(pb, fill_size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
78 put_be64(pb, ffm->pts);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
79 h = ffm->frame_offset;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
80 if (ffm->first_packet)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
81 h |= 0x8000;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
82 put_be16(pb, h);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
83 put_buffer(pb, ffm->packet, ffm->packet_end - ffm->packet);
751
dcb459ca11eb Flush the ffm packet to the wire (or file) whenever we flush the ffm packet.
philipjsg
parents: 744
diff changeset
84 put_flush_packet(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
85
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
86 /* prepare next packet */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
87 ffm->frame_offset = 0; /* no key frame */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
88 ffm->pts = 0; /* no pts */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
89 ffm->packet_ptr = ffm->packet;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
90 ffm->first_packet = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
91 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
92
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
93 /* 'first' is true if first data of a frame */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
94 static void ffm_write_data(AVFormatContext *s,
241
3d92f793fd67 64 bit pts for writing - more const usage
bellard
parents: 187
diff changeset
95 const uint8_t *buf, int size,
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
96 int64_t pts, int first)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
97 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
98 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
99 int len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
100
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
101 if (first && ffm->frame_offset == 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
102 ffm->frame_offset = ffm->packet_ptr - ffm->packet + FFM_HEADER_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
103 if (first && ffm->pts == 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
104 ffm->pts = pts;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
105
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
106 /* write as many packets as needed */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
107 while (size > 0) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
108 len = ffm->packet_end - ffm->packet_ptr;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
109 if (len > size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
110 len = size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
111 memcpy(ffm->packet_ptr, buf, len);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
112
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
113 ffm->packet_ptr += len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
114 buf += len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
115 size -= len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
116 if (ffm->packet_ptr >= ffm->packet_end) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
117 /* special case : no pts in packet : we leave the current one */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
118 if (ffm->pts == 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
119 ffm->pts = pts;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
120
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
121 flush_packet(s);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
122 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
123 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
124 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
125
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
126 static int ffm_write_header(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
127 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
128 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
129 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
130 FFMStream *fst;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
131 ByteIOContext *pb = &s->pb;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
132 AVCodecContext *codec;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
133 int bit_rate, i;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
134
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
135 ffm->packet_size = FFM_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
136
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
137 /* header */
862
aa0abab5e320 fix feed read_header, avoid using put_tag in write_header, to be consistent with read_header, also some minor cosmetics
alex
parents: 858
diff changeset
138 put_le32(pb, MKTAG('F', 'F', 'M', '1'));
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
139 put_be32(pb, ffm->packet_size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
140 /* XXX: store write position in other file ? */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
141 put_be64(pb, ffm->packet_size); /* current write position */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
142
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
143 put_be32(pb, s->nb_streams);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
144 bit_rate = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
145 for(i=0;i<s->nb_streams;i++) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
146 st = s->streams[i];
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 775
diff changeset
147 bit_rate += st->codec->bit_rate;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
148 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
149 put_be32(pb, bit_rate);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
150
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
151 /* list of streams */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
152 for(i=0;i<s->nb_streams;i++) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
153 st = s->streams[i];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
154 fst = av_mallocz(sizeof(FFMStream));
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
155 if (!fst)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
156 goto fail;
502
813b0119a98e ffserver fixes by (Koos Vriezen <koos.vriezen at xs4all dot nl>)
michael
parents: 468
diff changeset
157 av_set_pts_info(st, 64, 1, 1000000);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
158 st->priv_data = fst;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
159
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 775
diff changeset
160 codec = st->codec;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
161 /* generic info */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
162 put_be32(pb, codec->codec_id);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
163 put_byte(pb, codec->codec_type);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
164 put_be32(pb, codec->bit_rate);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
165 put_be32(pb, st->quality);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
166 put_be32(pb, codec->flags);
744
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
167 put_be32(pb, codec->flags2);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
168 put_be32(pb, codec->debug);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
169 /* specific info */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
170 switch(codec->codec_type) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
171 case CODEC_TYPE_VIDEO:
743
af4e24d6310c switch to native time bases
michael
parents: 683
diff changeset
172 put_be32(pb, codec->time_base.num);
af4e24d6310c switch to native time bases
michael
parents: 683
diff changeset
173 put_be32(pb, codec->time_base.den);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
174 put_be16(pb, codec->width);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
175 put_be16(pb, codec->height);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
176 put_be16(pb, codec->gop_size);
744
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
177 put_be32(pb, codec->pix_fmt);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
178 put_byte(pb, codec->qmin);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
179 put_byte(pb, codec->qmax);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
180 put_byte(pb, codec->max_qdiff);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
181 put_be16(pb, (int) (codec->qcompress * 10000.0));
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
182 put_be16(pb, (int) (codec->qblur * 10000.0));
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
183 put_be32(pb, codec->bit_rate_tolerance);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
184 put_strz(pb, codec->rc_eq);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
185 put_be32(pb, codec->rc_max_rate);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
186 put_be32(pb, codec->rc_min_rate);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
187 put_be32(pb, codec->rc_buffer_size);
823
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
188 put_be64(pb, av_dbl2int(codec->i_quant_factor));
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
189 put_be64(pb, av_dbl2int(codec->b_quant_factor));
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
190 put_be64(pb, av_dbl2int(codec->i_quant_offset));
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
191 put_be64(pb, av_dbl2int(codec->b_quant_offset));
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
192 put_be32(pb, codec->dct_algo);
744
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
193 put_be32(pb, codec->strict_std_compliance);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
194 put_be32(pb, codec->max_b_frames);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
195 put_be32(pb, codec->luma_elim_threshold);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
196 put_be32(pb, codec->chroma_elim_threshold);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
197 put_be32(pb, codec->mpeg_quant);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
198 put_be32(pb, codec->intra_dc_precision);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
199 put_be32(pb, codec->me_method);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
200 put_be32(pb, codec->mb_decision);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
201 put_be32(pb, codec->nsse_weight);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
202 put_be32(pb, codec->frame_skip_cmp);
823
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
203 put_be64(pb, av_dbl2int(codec->rc_buffer_aggressivity));
1809
491581a2b9a7 codec_tag settable via VideoTag, and transmit codec_tag in ffm
alex
parents: 1787
diff changeset
204 put_be32(pb, codec->codec_tag);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
205 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
206 case CODEC_TYPE_AUDIO:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
207 put_be32(pb, codec->sample_rate);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
208 put_le16(pb, codec->channels);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
209 put_le16(pb, codec->frame_size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
210 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
211 default:
537
558a093b04db do not call (av_)abort()
michael
parents: 502
diff changeset
212 return -1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
213 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
214 /* hack to have real time */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
215 if (ffm_nopts)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
216 fst->pts = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
217 else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
218 fst->pts = av_gettime();
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
219 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
220
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
221 /* flush until end of block reached */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
222 while ((url_ftell(pb) % ffm->packet_size) != 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
223 put_byte(pb, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
224
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
225 put_flush_packet(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
226
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
227 /* init packet mux */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
228 ffm->packet_ptr = ffm->packet;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
229 ffm->packet_end = ffm->packet + ffm->packet_size - FFM_HEADER_SIZE;
537
558a093b04db do not call (av_)abort()
michael
parents: 502
diff changeset
230 assert(ffm->packet_end >= ffm->packet);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
231 ffm->frame_offset = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
232 ffm->pts = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
233 ffm->first_packet = 1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
234
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
235 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
236 fail:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
237 for(i=0;i<s->nb_streams;i++) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
238 st = s->streams[i];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
239 av_freep(&st->priv_data);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
240 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
241 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
242 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
243
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
244 static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
245 {
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
246 AVStream *st = s->streams[pkt->stream_index];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
247 FFMStream *fst = st->priv_data;
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
248 int64_t pts;
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
249 uint8_t header[FRAME_HEADER_SIZE];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
250 int duration;
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
251 int size= pkt->size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
252
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
253 //XXX/FIXME use duration from pkt
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 775
diff changeset
254 if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 775
diff changeset
255 duration = ((float)st->codec->frame_size / st->codec->sample_rate * 1000000.0);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
256 } else {
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 775
diff changeset
257 duration = (1000000.0 * st->codec->time_base.num / (float)st->codec->time_base.den);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
258 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
259
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
260 pts = fst->pts;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
261 /* packet size & key_frame */
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
262 header[0] = pkt->stream_index;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
263 header[1] = 0;
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
264 if (pkt->flags & PKT_FLAG_KEY)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
265 header[1] |= FLAG_KEY_FRAME;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
266 header[2] = (size >> 16) & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
267 header[3] = (size >> 8) & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
268 header[4] = size & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
269 header[5] = (duration >> 16) & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
270 header[6] = (duration >> 8) & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
271 header[7] = duration & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
272 ffm_write_data(s, header, FRAME_HEADER_SIZE, pts, 1);
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
273 ffm_write_data(s, pkt->data, size, pts, 0);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
274
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
275 fst->pts += duration;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
276 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
277 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
278
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
279 static int ffm_write_trailer(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
280 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
281 ByteIOContext *pb = &s->pb;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
282 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
283
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
284 /* flush packets */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
285 if (ffm->packet_ptr > ffm->packet)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
286 flush_packet(s);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
287
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
288 put_flush_packet(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
289
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
290 if (!url_is_streamed(pb)) {
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
291 int64_t size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
292 /* update the write offset */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
293 size = url_ftell(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
294 url_fseek(pb, 8, SEEK_SET);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
295 put_be64(pb, size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
296 put_flush_packet(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
297 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
298
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
299 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
300 }
858
66cc656ea404 Replace CONFIG_ENCODERS/CONFIG_DECODERS with CONFIG_MUXERS/CONFIG_DEMUXERS
diego
parents: 823
diff changeset
301 #endif //CONFIG_MUXERS
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
302
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
303 /* ffm demux */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
304
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
305 static int ffm_is_avail_data(AVFormatContext *s, int size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
306 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
307 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
308 offset_t pos, avail_size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
309 int len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
310
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
311 len = ffm->packet_end - ffm->packet_ptr;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
312 if (!ffm_nopts) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
313 /* XXX: I don't understand this test, so I disabled it for testing */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
314 if (size <= len)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
315 return 1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
316 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
317 pos = url_ftell(&s->pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
318 if (pos == ffm->write_index) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
319 /* exactly at the end of stream */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
320 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
321 } else if (pos < ffm->write_index) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
322 avail_size = ffm->write_index - pos;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
323 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
324 avail_size = (ffm->file_size - pos) + (ffm->write_index - FFM_PACKET_SIZE);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
325 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
326 avail_size = (avail_size / ffm->packet_size) * (ffm->packet_size - FFM_HEADER_SIZE) + len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
327 if (size <= avail_size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
328 return 1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
329 else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
330 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
331 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
332
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
333 /* first is true if we read the frame header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
334 static int ffm_read_data(AVFormatContext *s,
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
335 uint8_t *buf, int size, int first)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
336 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
337 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
338 ByteIOContext *pb = &s->pb;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
339 int len, fill_size, size1, frame_offset;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
340
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
341 size1 = size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
342 while (size > 0) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
343 redo:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
344 len = ffm->packet_end - ffm->packet_ptr;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
345 if (len > size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
346 len = size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
347 if (len == 0) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
348 if (url_ftell(pb) == ffm->file_size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
349 url_fseek(pb, ffm->packet_size, SEEK_SET);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
350 retry_read:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
351 get_be16(pb); /* PACKET_ID */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
352 fill_size = get_be16(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
353 ffm->pts = get_be64(pb);
901
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
354 ffm->first_frame_in_packet = 1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
355 frame_offset = get_be16(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
356 get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
357 ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
358 if (ffm->packet_end < ffm->packet)
537
558a093b04db do not call (av_)abort()
michael
parents: 502
diff changeset
359 return -1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
360 /* if first packet or resynchronization packet, we must
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
361 handle it specifically */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
362 if (ffm->first_packet || (frame_offset & 0x8000)) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
363 if (!frame_offset) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
364 /* This packet has no frame headers in it */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
365 if (url_ftell(pb) >= ffm->packet_size * 3) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
366 url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
367 goto retry_read;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
368 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
369 /* This is bad, we cannot find a valid frame header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
370 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
371 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
372 ffm->first_packet = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
373 if ((frame_offset & 0x7ffff) < FFM_HEADER_SIZE)
537
558a093b04db do not call (av_)abort()
michael
parents: 502
diff changeset
374 return -1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
375 ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
376 if (!first)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
377 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
378 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
379 ffm->packet_ptr = ffm->packet;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
380 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
381 goto redo;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
382 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
383 memcpy(buf, ffm->packet_ptr, len);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
384 buf += len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
385 ffm->packet_ptr += len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
386 size -= len;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
387 first = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
388 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
389 return size1 - size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
390 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
391
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
392
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
393 static void adjust_write_index(AVFormatContext *s)
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
394 {
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
395 FFMContext *ffm = s->priv_data;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
396 ByteIOContext *pb = &s->pb;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
397 int64_t pts;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
398 //offset_t orig_write_index = ffm->write_index;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
399 offset_t pos_min, pos_max;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
400 int64_t pts_start;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
401 offset_t ptr = url_ftell(pb);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
402
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
403
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
404 pos_min = 0;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
405 pos_max = ffm->file_size - 2 * FFM_PACKET_SIZE;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
406
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
407 pts_start = get_pts(s, pos_min);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
408
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
409 pts = get_pts(s, pos_max);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
410
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
411 if (pts - 100000 > pts_start)
390
3a40642dc4df adjust_write_index() fix by ("Curi Fabio Eduardo (SFL)" <curif at TELEFONICA dot COM dot AR>)
michael
parents: 318
diff changeset
412 goto end;
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
413
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
414 ffm->write_index = FFM_PACKET_SIZE;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
415
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
416 pts_start = get_pts(s, pos_min);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
417
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
418 pts = get_pts(s, pos_max);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
419
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
420 if (pts - 100000 <= pts_start) {
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
421 while (1) {
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
422 offset_t newpos;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
423 int64_t newpts;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
424
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
425 newpos = ((pos_max + pos_min) / (2 * FFM_PACKET_SIZE)) * FFM_PACKET_SIZE;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
426
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
427 if (newpos == pos_min)
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
428 break;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
429
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
430 newpts = get_pts(s, newpos);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
431
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
432 if (newpts - 100000 <= pts) {
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
433 pos_max = newpos;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
434 pts = newpts;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
435 } else {
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
436 pos_min = newpos;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
437 }
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
438 }
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
439 ffm->write_index += pos_max;
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
440 }
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
441
1443
404048ea11bc Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts.
diego
parents: 1415
diff changeset
442 //printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.);
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
443 //printf("pts range %0.6f - %0.6f\n", get_pts(s, 0) / 1000000. , get_pts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
444
390
3a40642dc4df adjust_write_index() fix by ("Curi Fabio Eduardo (SFL)" <curif at TELEFONICA dot COM dot AR>)
michael
parents: 318
diff changeset
445 end:
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
446 url_fseek(pb, ptr, SEEK_SET);
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
447 }
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
448
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
449
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
450 static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
451 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
452 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
453 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
454 FFMStream *fst;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
455 ByteIOContext *pb = &s->pb;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
456 AVCodecContext *codec;
187
2fa5e94ba716 add av_new_stream() usage
bellard
parents: 85
diff changeset
457 int i, nb_streams;
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
458 uint32_t tag;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
459
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
460 /* header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
461 tag = get_le32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
462 if (tag != MKTAG('F', 'F', 'M', '1'))
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
463 goto fail;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
464 ffm->packet_size = get_be32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
465 if (ffm->packet_size != FFM_PACKET_SIZE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
466 goto fail;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
467 ffm->write_index = get_be64(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
468 /* get also filesize */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
469 if (!url_is_streamed(pb)) {
764
cdb845a57ae4 drop most url_fileno() calls (allows to use ByteIOContext directly in caller apps instead of URLProtocol)
aurel
parents: 751
diff changeset
470 ffm->file_size = url_fsize(pb);
318
54e915169d48 Add more resilience in reading ffm files. In particular, don't assume
philipjsg
parents: 277
diff changeset
471 adjust_write_index(s);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
472 } else {
1556
65b7b3ff4ed7 use the standard INT64_C() macro for 64-bit constants
mru
parents: 1443
diff changeset
473 ffm->file_size = (UINT64_C(1) << 63) - 1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
474 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
475
187
2fa5e94ba716 add av_new_stream() usage
bellard
parents: 85
diff changeset
476 nb_streams = get_be32(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
477 get_be32(pb); /* total bitrate */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
478 /* read each stream */
187
2fa5e94ba716 add av_new_stream() usage
bellard
parents: 85
diff changeset
479 for(i=0;i<nb_streams;i++) {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
480 char rc_eq_buf[128];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
481
187
2fa5e94ba716 add av_new_stream() usage
bellard
parents: 85
diff changeset
482 st = av_new_stream(s, 0);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
483 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
484 goto fail;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
485 fst = av_mallocz(sizeof(FFMStream));
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
486 if (!fst)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
487 goto fail;
862
aa0abab5e320 fix feed read_header, avoid using put_tag in write_header, to be consistent with read_header, also some minor cosmetics
alex
parents: 858
diff changeset
488 s->streams[i] = st;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
489
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 390
diff changeset
490 av_set_pts_info(st, 64, 1, 1000000);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
491
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
492 st->priv_data = fst;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
493
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 775
diff changeset
494 codec = st->codec;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
495 /* generic info */
862
aa0abab5e320 fix feed read_header, avoid using put_tag in write_header, to be consistent with read_header, also some minor cosmetics
alex
parents: 858
diff changeset
496 codec->codec_id = get_be32(pb);
aa0abab5e320 fix feed read_header, avoid using put_tag in write_header, to be consistent with read_header, also some minor cosmetics
alex
parents: 858
diff changeset
497 codec->codec_type = get_byte(pb); /* codec_type */
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
498 codec->bit_rate = get_be32(pb);
862
aa0abab5e320 fix feed read_header, avoid using put_tag in write_header, to be consistent with read_header, also some minor cosmetics
alex
parents: 858
diff changeset
499 st->quality = get_be32(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
500 codec->flags = get_be32(pb);
744
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
501 codec->flags2 = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
502 codec->debug = get_be32(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
503 /* specific info */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
504 switch(codec->codec_type) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
505 case CODEC_TYPE_VIDEO:
743
af4e24d6310c switch to native time bases
michael
parents: 683
diff changeset
506 codec->time_base.num = get_be32(pb);
af4e24d6310c switch to native time bases
michael
parents: 683
diff changeset
507 codec->time_base.den = get_be32(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
508 codec->width = get_be16(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
509 codec->height = get_be16(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
510 codec->gop_size = get_be16(pb);
744
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
511 codec->pix_fmt = get_be32(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
512 codec->qmin = get_byte(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
513 codec->qmax = get_byte(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
514 codec->max_qdiff = get_byte(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
515 codec->qcompress = get_be16(pb) / 10000.0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
516 codec->qblur = get_be16(pb) / 10000.0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
517 codec->bit_rate_tolerance = get_be32(pb);
34
f17e285df237 use av_strdup()
bellard
parents: 7
diff changeset
518 codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
519 codec->rc_max_rate = get_be32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
520 codec->rc_min_rate = get_be32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
521 codec->rc_buffer_size = get_be32(pb);
823
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
522 codec->i_quant_factor = av_int2dbl(get_be64(pb));
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
523 codec->b_quant_factor = av_int2dbl(get_be64(pb));
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
524 codec->i_quant_offset = av_int2dbl(get_be64(pb));
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
525 codec->b_quant_offset = av_int2dbl(get_be64(pb));
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
526 codec->dct_algo = get_be32(pb);
744
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
527 codec->strict_std_compliance = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
528 codec->max_b_frames = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
529 codec->luma_elim_threshold = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
530 codec->chroma_elim_threshold = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
531 codec->mpeg_quant = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
532 codec->intra_dc_precision = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
533 codec->me_method = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
534 codec->mb_decision = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
535 codec->nsse_weight = get_be32(pb);
da5b3b9e898e Add in many fields that have been added to the Codec structure. This means
philipjsg
parents: 743
diff changeset
536 codec->frame_skip_cmp = get_be32(pb);
823
e8b4454b997d remove non portable get/put_be64_double()
michael
parents: 820
diff changeset
537 codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb));
1809
491581a2b9a7 codec_tag settable via VideoTag, and transmit codec_tag in ffm
alex
parents: 1787
diff changeset
538 codec->codec_tag = get_be32(pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
539 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
540 case CODEC_TYPE_AUDIO:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
541 codec->sample_rate = get_be32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
542 codec->channels = get_le16(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
543 codec->frame_size = get_le16(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
544 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
545 default:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
546 goto fail;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
547 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
548
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
549 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
550
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
551 /* get until end of block reached */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
552 while ((url_ftell(pb) % ffm->packet_size) != 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
553 get_byte(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
554
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
555 /* init packet demux */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
556 ffm->packet_ptr = ffm->packet;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
557 ffm->packet_end = ffm->packet;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
558 ffm->frame_offset = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
559 ffm->pts = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
560 ffm->read_state = READ_HEADER;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
561 ffm->first_packet = 1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
562 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
563 fail:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
564 for(i=0;i<s->nb_streams;i++) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
565 st = s->streams[i];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
566 if (st) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
567 av_freep(&st->priv_data);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
568 av_free(st);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
569 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
570 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
571 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
572 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
573
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
574 /* return < 0 if eof */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
575 static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
576 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
577 int size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
578 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
579 int duration;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
580
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
581 switch(ffm->read_state) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
582 case READ_HEADER:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
583 if (!ffm_is_avail_data(s, FRAME_HEADER_SIZE)) {
1787
eb16c64144ee This fixes error handling for BeOS, removing the need for some ifdefs.
mmu_man
parents: 1556
diff changeset
584 return AVERROR(EAGAIN);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
585 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
586 #if 0
1443
404048ea11bc Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts.
diego
parents: 1415
diff changeset
587 printf("pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
588 url_ftell(&s->pb), s->pb.pos, ffm->write_index, ffm->file_size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
589 #endif
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
590 if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
591 FRAME_HEADER_SIZE)
1787
eb16c64144ee This fixes error handling for BeOS, removing the need for some ifdefs.
mmu_man
parents: 1556
diff changeset
592 return AVERROR(EAGAIN);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
593 #if 0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
594 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
595 int i;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
596 for(i=0;i<FRAME_HEADER_SIZE;i++)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
597 printf("%02x ", ffm->header[i]);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
598 printf("\n");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
599 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
600 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
601 ffm->read_state = READ_DATA;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
602 /* fall thru */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
603 case READ_DATA:
2222
3427d0c63a32 Use AV_RB* macros where appropriate.
diego
parents: 2001
diff changeset
604 size = AV_RB24(ffm->header + 2);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
605 if (!ffm_is_avail_data(s, size)) {
1787
eb16c64144ee This fixes error handling for BeOS, removing the need for some ifdefs.
mmu_man
parents: 1556
diff changeset
606 return AVERROR(EAGAIN);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
607 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
608
2222
3427d0c63a32 Use AV_RB* macros where appropriate.
diego
parents: 2001
diff changeset
609 duration = AV_RB24(ffm->header + 5);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
610
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
611 av_new_packet(pkt, size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
612 pkt->stream_index = ffm->header[0];
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
613 pkt->pos = url_ftell(&s->pb);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
614 if (ffm->header[1] & FLAG_KEY_FRAME)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
615 pkt->flags |= PKT_FLAG_KEY;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
616
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
617 ffm->read_state = READ_HEADER;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
618 if (ffm_read_data(s, pkt->data, size, 0) != size) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
619 /* bad case: desynchronized packet. we cancel all the packet loading */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
620 av_free_packet(pkt);
1787
eb16c64144ee This fixes error handling for BeOS, removing the need for some ifdefs.
mmu_man
parents: 1556
diff changeset
621 return AVERROR(EAGAIN);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
622 }
901
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
623 if (ffm->first_frame_in_packet)
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
624 {
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
625 pkt->pts = ffm->pts;
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
626 ffm->first_frame_in_packet = 0;
c1a07d63a66d pts fix by (Bryan Mayland / bmayland O leoninedev o com)
michael
parents: 896
diff changeset
627 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
628 pkt->duration = duration;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
629 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
630 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
631 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
632 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
633
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
634 //#define DEBUG_SEEK
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
635
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
636 /* pos is between 0 and file_size - FFM_PACKET_SIZE. It is translated
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
637 by the write position inside this function */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
638 static void ffm_seek1(AVFormatContext *s, offset_t pos1)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
639 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
640 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
641 ByteIOContext *pb = &s->pb;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
642 offset_t pos;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
643
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
644 pos = pos1 + ffm->write_index;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
645 if (pos >= ffm->file_size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
646 pos -= (ffm->file_size - FFM_PACKET_SIZE);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
647 #ifdef DEBUG_SEEK
1443
404048ea11bc Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts.
diego
parents: 1415
diff changeset
648 printf("seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
649 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
650 url_fseek(pb, pos, SEEK_SET);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
651 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
652
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
653 static int64_t get_pts(AVFormatContext *s, offset_t pos)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
654 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
655 ByteIOContext *pb = &s->pb;
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
656 int64_t pts;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
657
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
658 ffm_seek1(s, pos);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
659 url_fskip(pb, 4);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
660 pts = get_be64(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
661 #ifdef DEBUG_SEEK
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
662 printf("pts=%0.6f\n", pts / 1000000.0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
663 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
664 return pts;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
665 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
666
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
667 /* seek to a given time in the file. The file read pointer is
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
668 positionned at or before pts. XXX: the following code is quite
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
669 approximative */
558
89bd76208427 100l (forgoten seeking functions)
michael
parents: 540
diff changeset
670 static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
671 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
672 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
673 offset_t pos_min, pos_max, pos;
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
674 int64_t pts_min, pts_max, pts;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
675 double pos1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
676
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
677 #ifdef DEBUG_SEEK
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
678 printf("wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
679 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
680 /* find the position using linear interpolation (better than
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
681 dichotomy in typical cases) */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
682 pos_min = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
683 pos_max = ffm->file_size - 2 * FFM_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
684 while (pos_min <= pos_max) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
685 pts_min = get_pts(s, pos_min);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
686 pts_max = get_pts(s, pos_max);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
687 /* linear interpolation */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
688 pos1 = (double)(pos_max - pos_min) * (double)(wanted_pts - pts_min) /
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
689 (double)(pts_max - pts_min);
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
690 pos = (((int64_t)pos1) / FFM_PACKET_SIZE) * FFM_PACKET_SIZE;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
691 if (pos <= pos_min)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
692 pos = pos_min;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
693 else if (pos >= pos_max)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
694 pos = pos_max;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
695 pts = get_pts(s, pos);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
696 /* check if we are lucky */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
697 if (pts == wanted_pts) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
698 goto found;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
699 } else if (pts > wanted_pts) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
700 pos_max = pos - FFM_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
701 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
702 pos_min = pos + FFM_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
703 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
704 }
558
89bd76208427 100l (forgoten seeking functions)
michael
parents: 540
diff changeset
705 pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
706 if (pos > 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
707 pos -= FFM_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
708 found:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
709 ffm_seek1(s, pos);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
710 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
711 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
712
905
dbc0145bbf11 Add --disable-protocols option to configure to disable I/O protocol from
diego
parents: 901
diff changeset
713 #ifdef CONFIG_FFSERVER
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
714 offset_t ffm_read_write_index(int fd)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
715 {
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
716 uint8_t buf[8];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
717
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
718 lseek(fd, 8, SEEK_SET);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
719 read(fd, buf, 8);
2222
3427d0c63a32 Use AV_RB* macros where appropriate.
diego
parents: 2001
diff changeset
720 return AV_RB64(buf);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
721 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
722
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
723 void ffm_write_write_index(int fd, offset_t pos)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
724 {
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 34
diff changeset
725 uint8_t buf[8];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
726 int i;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
727
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
728 for(i=0;i<8;i++)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
729 buf[i] = (pos >> (56 - i * 8)) & 0xff;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
730 lseek(fd, 8, SEEK_SET);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
731 write(fd, buf, 8);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
732 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
733
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
734 void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
735 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
736 FFMContext *ffm = s->priv_data;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
737 ffm->write_index = pos;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
738 ffm->file_size = file_size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
739 }
905
dbc0145bbf11 Add --disable-protocols option to configure to disable I/O protocol from
diego
parents: 901
diff changeset
740 #endif // CONFIG_FFSERVER
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
741
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
742 static int ffm_read_close(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
743 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
744 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
745 int i;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
746
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
747 for(i=0;i<s->nb_streams;i++) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
748 st = s->streams[i];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
749 av_freep(&st->priv_data);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
750 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
751 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
752 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
753
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
754 static int ffm_probe(AVProbeData *p)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
755 {
2001
1a3c9056982a allocate 32 extra bytes at the end of the probe buffer and remove most probe buf_size checks
michael
parents: 1809
diff changeset
756 if (
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 862
diff changeset
757 p->buf[0] == 'F' && p->buf[1] == 'F' && p->buf[2] == 'M' &&
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
758 p->buf[3] == '1')
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
759 return AVPROBE_SCORE_MAX + 1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
760 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
761 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
762
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
763 #ifdef CONFIG_FFM_DEMUXER
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
764 AVInputFormat ffm_demuxer = {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
765 "ffm",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
766 "ffm format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
767 sizeof(FFMContext),
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
768 ffm_probe,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
769 ffm_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
770 ffm_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
771 ffm_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
772 ffm_seek,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
773 };
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
774 #endif
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
775 #ifdef CONFIG_FFM_MUXER
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
776 AVOutputFormat ffm_muxer = {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
777 "ffm",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
778 "ffm format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
779 "",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
780 "ffm",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
781 sizeof(FFMContext),
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
782 /* not really used */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
783 CODEC_ID_MP2,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
784 CODEC_ID_MPEG1VIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
785 ffm_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
786 ffm_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
787 ffm_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
788 };
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
789 #endif //CONFIG_FFM_MUXER