| OLD | NEW |
| 1 /* | 1 /* |
| 2 * copyright (c) 2002 Mark Hills <mark@pogo.org.uk> | 2 * copyright (c) 2002 Mark Hills <mark@pogo.org.uk> |
| 3 * | 3 * |
| 4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
| 5 * | 5 * |
| 6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if(context->buffer_index){ | 185 if(context->buffer_index){ |
| 186 ogg_packet *op2= (ogg_packet*)context->buffer; | 186 ogg_packet *op2= (ogg_packet*)context->buffer; |
| 187 op2->packet = context->buffer + sizeof(ogg_packet); | 187 op2->packet = context->buffer + sizeof(ogg_packet); |
| 188 | 188 |
| 189 l= op2->bytes; | 189 l= op2->bytes; |
| 190 avccontext->coded_frame->pts= av_rescale_q(op2->granulepos, (AVRational)
{1, avccontext->sample_rate}, avccontext->time_base); | 190 avccontext->coded_frame->pts= av_rescale_q(op2->granulepos, (AVRational)
{1, avccontext->sample_rate}, avccontext->time_base); |
| 191 //FIXME we should reorder the user supplied pts and not assume that they
are spaced by 1/sample_rate | 191 //FIXME we should reorder the user supplied pts and not assume that they
are spaced by 1/sample_rate |
| 192 | 192 |
| 193 memcpy(packets, op2->packet, l); | 193 memcpy(packets, op2->packet, l); |
| 194 context->buffer_index -= l + sizeof(ogg_packet); | 194 context->buffer_index -= l + sizeof(ogg_packet); |
| 195 memcpy(context->buffer, context->buffer + l + sizeof(ogg_packet), contex
t->buffer_index); | 195 memmove(context->buffer, context->buffer + l + sizeof(ogg_packet), conte
xt->buffer_index); |
| 196 // av_log(avccontext, AV_LOG_DEBUG, "E%d\n", l); | 196 // av_log(avccontext, AV_LOG_DEBUG, "E%d\n", l); |
| 197 } | 197 } |
| 198 | 198 |
| 199 return l; | 199 return l; |
| 200 } | 200 } |
| 201 | 201 |
| 202 | 202 |
| 203 static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) { | 203 static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) { |
| 204 OggVorbisContext *context = avccontext->priv_data ; | 204 OggVorbisContext *context = avccontext->priv_data ; |
| 205 /* ogg_packet op ; */ | 205 /* ogg_packet op ; */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 222 AVMEDIA_TYPE_AUDIO, | 222 AVMEDIA_TYPE_AUDIO, |
| 223 CODEC_ID_VORBIS, | 223 CODEC_ID_VORBIS, |
| 224 sizeof(OggVorbisContext), | 224 sizeof(OggVorbisContext), |
| 225 oggvorbis_encode_init, | 225 oggvorbis_encode_init, |
| 226 oggvorbis_encode_frame, | 226 oggvorbis_encode_frame, |
| 227 oggvorbis_encode_close, | 227 oggvorbis_encode_close, |
| 228 .capabilities= CODEC_CAP_DELAY, | 228 .capabilities= CODEC_CAP_DELAY, |
| 229 .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, | 229 .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, |
| 230 .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"), | 230 .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"), |
| 231 } ; | 231 } ; |
| OLD | NEW |