comparison amr.c @ 1367:8e0ee2faf4d5 libavformat

set duration and timebase (based on a patch by Simon Morlat simon.morlat linphone org)
author michael
date Tue, 10 Oct 2006 23:49:45 +0000
parents 31ab2ac4e173
children f9d59429f182
comparison
equal deleted inserted replaced
1366:31ab2ac4e173 1367:8e0ee2faf4d5
122 st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r'); 122 st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
123 st->codec->codec_id = CODEC_ID_AMR_NB; 123 st->codec->codec_id = CODEC_ID_AMR_NB;
124 st->codec->channels = 1; 124 st->codec->channels = 1;
125 st->codec->sample_rate = 8000; 125 st->codec->sample_rate = 8000;
126 } 126 }
127 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
127 128
128 return 0; 129 return 0;
129 } 130 }
130 131
131 #define MAX_SIZE 32 132 #define MAX_SIZE 32
167 } 168 }
168 169
169 pkt->stream_index = 0; 170 pkt->stream_index = 0;
170 pkt->pos= url_ftell(&s->pb); 171 pkt->pos= url_ftell(&s->pb);
171 pkt->data[0]=toc; 172 pkt->data[0]=toc;
173 pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
172 read = get_buffer(&s->pb, pkt->data+1, size-1); 174 read = get_buffer(&s->pb, pkt->data+1, size-1);
173 175
174 if (read != size-1) 176 if (read != size-1)
175 { 177 {
176 av_free_packet(pkt); 178 av_free_packet(pkt);