comparison movenc.c @ 1152:c7cf3d1f9bd7 libavformat

simplify and write correct values conforming to specs
author bcoudurier
date Thu, 06 Jul 2006 14:38:50 +0000
parents bf808f3f7f46
children 6cb1c11cc363
comparison
equal deleted inserted replaced
1151:bf808f3f7f46 1152:c7cf3d1f9bd7
198 put_be32(pb, index); // rewrite size 198 put_be32(pb, index); // rewrite size
199 url_fseek(pb, curpos, SEEK_SET); 199 url_fseek(pb, curpos, SEEK_SET);
200 return updateSize (pb, pos); 200 return updateSize (pb, pos);
201 } 201 }
202 202
203 static int mov_write_damr_tag(ByteIOContext *pb) 203 static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track)
204 { 204 {
205 put_be32(pb, 0x11); /* size */ 205 put_be32(pb, 0x11); /* size */
206 put_tag(pb, "damr"); 206 if (track->mode == MODE_MOV) put_tag(pb, "samr");
207 else put_tag(pb, "damr");
207 put_tag(pb, "FFMP"); 208 put_tag(pb, "FFMP");
208 put_byte(pb, 0); 209 put_byte(pb, 0); /* decoder version */
209
210 //put_be16(pb, 0x80); /* Mode set (all modes for AMR_NB) */
211 //put_be16(pb, 0xa); /* Mode change period (no restriction) */
212 put_be16(pb, 0x81ff); /* Mode set (all modes for AMR_NB) */
213 put_be16(pb, 1); /* Mode change period (no restriction) */
214 return 0x11;
215 }
216
217 static int mov_write_samr_tag(ByteIOContext *pb)
218 {
219 put_be32(pb, 0x11); /* size */
220 put_tag(pb, "samr");
221 put_tag(pb, "FFMP");
222 put_byte(pb, 1);
223 210
224 put_be16(pb, 0x80); /* Mode set (all modes for AMR_NB) */ 211 put_be16(pb, 0x80); /* Mode set (all modes for AMR_NB) */
225 put_be16(pb, 0x5); /* Mode change period (no restriction) */ 212 put_byte(pb, 0x00); /* Mode change period (no restriction) */
213 put_byte(pb, 0x01); /* Frames per sample */
226 return 0x11; 214 return 0x11;
227 } 215 }
228 216
229 static int mov_write_enda_tag(ByteIOContext *pb) 217 static int mov_write_enda_tag(ByteIOContext *pb)
230 { 218 {
320 mov_write_esds_tag(pb, track); 308 mov_write_esds_tag(pb, track);
321 } else if (track->enc->codec_id == CODEC_ID_PCM_S24LE || 309 } else if (track->enc->codec_id == CODEC_ID_PCM_S24LE ||
322 track->enc->codec_id == CODEC_ID_PCM_S32LE) { 310 track->enc->codec_id == CODEC_ID_PCM_S32LE) {
323 mov_write_enda_tag(pb); 311 mov_write_enda_tag(pb);
324 } else if (track->enc->codec_id == CODEC_ID_AMR_NB) { 312 } else if (track->enc->codec_id == CODEC_ID_AMR_NB) {
325 mov_write_samr_tag(pb); 313 mov_write_amr_tag(pb, track);
326 } 314 }
327 315
328 put_be32(pb, 8); /* size */ 316 put_be32(pb, 8); /* size */
329 put_be32(pb, 0); /* null tag */ 317 put_be32(pb, 0); /* null tag */
330 318
402 track->enc->codec_id == CODEC_ID_PCM_S32LE)) 390 track->enc->codec_id == CODEC_ID_PCM_S32LE))
403 mov_write_wave_tag(pb, track); 391 mov_write_wave_tag(pb, track);
404 else if(track->enc->codec_id == CODEC_ID_AAC) 392 else if(track->enc->codec_id == CODEC_ID_AAC)
405 mov_write_esds_tag(pb, track); 393 mov_write_esds_tag(pb, track);
406 else if(track->enc->codec_id == CODEC_ID_AMR_NB) 394 else if(track->enc->codec_id == CODEC_ID_AMR_NB)
407 mov_write_damr_tag(pb); 395 mov_write_amr_tag(pb, track);
408 396
409 return updateSize (pb, pos); 397 return updateSize (pb, pos);
410 } 398 }
411 399
412 static int mov_write_d263_tag(ByteIOContext *pb) 400 static int mov_write_d263_tag(ByteIOContext *pb)