[Ffmpeg-cvslog] CVS: ffmpeg ffmpeg.c, 1.338, 1.339 output_example.c, 1.14, 1.15 ffplay.c, 1.47, 1.48 ffserver.c, 1.93, 1.94
Michael Niedermayer CVS
michael
Mon Jul 18 00:24:38 CEST 2005
- Previous message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mjpeg.c,1.110,1.111
- Next message: [Ffmpeg-cvslog] CVS: ffmpeg ffmpeg.c, 1.338, 1.339 output_example.c, 1.14, 1.15 ffplay.c, 1.47, 1.48 ffserver.c, 1.93, 1.94
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/ffmpeg/ffmpeg
In directory mail:/var2/tmp/cvs-serv17896
Modified Files:
ffmpeg.c output_example.c ffplay.c ffserver.c
Log Message:
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
Index: ffmpeg.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/ffmpeg.c,v
retrieving revision 1.338
retrieving revision 1.339
diff -u -d -r1.338 -r1.339
--- ffmpeg.c 17 Jul 2005 00:28:11 -0000 1.338
+++ ffmpeg.c 17 Jul 2005 22:24:34 -0000 1.339
@@ -493,7 +493,7 @@
const int audio_out_size= 4*MAX_AUDIO_PACKET_SIZE;
int size_out, frame_bytes, ret;
- AVCodecContext *enc= &ost->st->codec;
+ AVCodecContext *enc= ost->st->codec;
/* SC: dynamic allocation of buffers */
if (!audio_buf)
@@ -505,9 +505,9 @@
if(audio_sync_method){
double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts
- - fifo_size(&ost->fifo, ost->fifo.rptr)/(ost->st->codec.channels * 2);
- double idelta= delta*ist->st->codec.sample_rate / enc->sample_rate;
- int byte_delta= ((int)idelta)*2*ist->st->codec.channels;
+ - fifo_size(&ost->fifo, ost->fifo.rptr)/(ost->st->codec->channels * 2);
+ double idelta= delta*ist->st->codec->sample_rate / enc->sample_rate;
+ int byte_delta= ((int)idelta)*2*ist->st->codec->channels;
//FIXME resample delay
if(fabs(delta) > 50){
@@ -542,19 +542,19 @@
assert(ost->audio_resample);
if(verbose > 2)
fprintf(stderr, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate);
-// fprintf(stderr, "drift:%f len:%d opts:%lld ipts:%lld fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), fifo_size(&ost->fifo, ost->fifo.rptr)/(ost->st->codec.channels * 2));
+// fprintf(stderr, "drift:%f len:%d opts:%lld ipts:%lld fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), fifo_size(&ost->fifo, ost->fifo.rptr)/(ost->st->codec->channels * 2));
av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate);
}
}
}else
ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate)
- - fifo_size(&ost->fifo, ost->fifo.rptr)/(ost->st->codec.channels * 2); //FIXME wrong
+ - fifo_size(&ost->fifo, ost->fifo.rptr)/(ost->st->codec->channels * 2); //FIXME wrong
if (ost->audio_resample) {
buftmp = audio_buf;
size_out = audio_resample(ost->resample,
(short *)buftmp, (short *)buf,
- size / (ist->st->codec.channels * 2));
+ size / (ist->st->codec->channels * 2));
size_out = size_out * enc->channels * 2;
} else {
buftmp = buf;
@@ -625,7 +625,7 @@
AVPicture picture_tmp;
uint8_t *buf = 0;
- dec = &ist->st->codec;
+ dec = ist->st->codec;
/* deinterlace : must be done before any resize */
if (do_deinterlace || using_vhook) {
@@ -721,7 +721,7 @@
return;
}
- enc = &ost->st->codec;
+ enc = ost->st->codec;
if (!subtitle_out) {
subtitle_out = av_malloc(subtitle_out_max_size);
@@ -775,8 +775,8 @@
avcodec_get_frame_defaults(&picture_format_temp);
avcodec_get_frame_defaults(&picture_crop_temp);
- enc = &ost->st->codec;
- dec = &ist->st->codec;
+ enc = ost->st->codec;
+ dec = ist->st->codec;
/* by default, we output a single frame */
nb_frames = 1;
@@ -1049,7 +1049,7 @@
}
ti = MAXINT64;
- enc = &ost->st->codec;
+ enc = ost->st->codec;
if (enc->codec_type == CODEC_TYPE_VIDEO) {
frame_number = ost->frame_number;
fprintf(fvstats, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
@@ -1107,7 +1107,7 @@
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
os = output_files[ost->file_index];
- enc = &ost->st->codec;
+ enc = ost->st->codec;
if (vid && enc->codec_type == CODEC_TYPE_VIDEO) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ",
enc->coded_frame->quality/(float)FF_QP2LAMBDA);
@@ -1220,13 +1220,13 @@
data_size = 0;
subtitle_to_free = NULL;
if (ist->decoding_needed) {
- switch(ist->st->codec.codec_type) {
+ switch(ist->st->codec->codec_type) {
case CODEC_TYPE_AUDIO:{
if(pkt)
samples= av_fast_realloc(samples, &samples_size, FFMAX(pkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE));
/* XXX: could avoid copy if PCM 16 bits with same
endianness as CPU */
- ret = avcodec_decode_audio(&ist->st->codec, samples, &data_size,
+ ret = avcodec_decode_audio(ist->st->codec, samples, &data_size,
ptr, len);
if (ret < 0)
goto fail_decode;
@@ -1240,14 +1240,14 @@
}
data_buf = (uint8_t *)samples;
ist->next_pts += ((int64_t)AV_TIME_BASE/2 * data_size) /
- (ist->st->codec.sample_rate * ist->st->codec.channels);
+ (ist->st->codec->sample_rate * ist->st->codec->channels);
break;}
case CODEC_TYPE_VIDEO:
- data_size = (ist->st->codec.width * ist->st->codec.height * 3) / 2;
+ data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
/* XXX: allocate picture correctly */
avcodec_get_frame_defaults(&picture);
- ret = avcodec_decode_video(&ist->st->codec,
+ ret = avcodec_decode_video(ist->st->codec,
&picture, &got_picture, ptr, len);
ist->st->quality= picture.quality;
if (ret < 0)
@@ -1256,15 +1256,15 @@
/* no picture yet */
goto discard_packet;
}
- if (ist->st->codec.time_base.num != 0) {
+ if (ist->st->codec->time_base.num != 0) {
ist->next_pts += ((int64_t)AV_TIME_BASE *
- ist->st->codec.time_base.num) /
- ist->st->codec.time_base.den;
+ ist->st->codec->time_base.num) /
+ ist->st->codec->time_base.den;
}
len = 0;
break;
case CODEC_TYPE_SUBTITLE:
- ret = avcodec_decode_subtitle(&ist->st->codec,
+ ret = avcodec_decode_subtitle(ist->st->codec,
&subtitle, &got_subtitle, ptr, len);
if (ret < 0)
goto fail_decode;
@@ -1278,16 +1278,16 @@
goto fail_decode;
}
} else {
- switch(ist->st->codec.codec_type) {
+ switch(ist->st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
- ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec.frame_size) /
- (ist->st->codec.sample_rate * ist->st->codec.channels);
+ ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
+ (ist->st->codec->sample_rate * ist->st->codec->channels);
break;
case CODEC_TYPE_VIDEO:
- if (ist->st->codec.time_base.num != 0) {
+ if (ist->st->codec->time_base.num != 0) {
ist->next_pts += ((int64_t)AV_TIME_BASE *
- ist->st->codec.time_base.num) /
- ist->st->codec.time_base.den;
+ ist->st->codec->time_base.num) /
+ ist->st->codec->time_base.den;
}
break;
}
@@ -1298,13 +1298,13 @@
}
buffer_to_free = NULL;
- if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO) {
+ if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO) {
pre_process_video_frame(ist, (AVPicture *)&picture,
&buffer_to_free);
}
// preprocess audio (volume)
- if (ist->st->codec.codec_type == CODEC_TYPE_AUDIO) {
+ if (ist->st->codec->codec_type == CODEC_TYPE_AUDIO) {
if (audio_volume != 256) {
short *volp;
volp = samples;
@@ -1318,8 +1318,8 @@
}
/* frame rate emulation */
- if (ist->st->codec.rate_emu) {
- int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec.time_base.num, 1000000, ist->st->codec.time_base.den);
+ if (ist->st->codec->rate_emu) {
+ int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec->time_base.num, 1000000, ist->st->codec->time_base.den);
int64_t now = av_gettime() - ist->start;
if (pts > now)
usleep(pts - now);
@@ -1331,8 +1331,8 @@
/* mpeg PTS deordering : if it is a P or I frame, the PTS
is the one of the next displayed one */
/* XXX: add mpeg4 too ? */
- if (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) {
- if (ist->st->codec.pict_type != B_TYPE) {
+ if (ist->st->codec->codec_id == CODEC_ID_MPEG1VIDEO) {
+ if (ist->st->codec->pict_type != B_TYPE) {
int64_t tmp;
tmp = ist->last_ip_pts;
ist->last_ip_pts = ist->frac_pts.val;
@@ -1360,7 +1360,7 @@
//ost->sync_ipts = (double)(ist->pts + input_files_ts_offset[ist->file_index] - start_time)/ AV_TIME_BASE;
if (ost->encoding_needed) {
- switch(ost->st->codec.codec_type) {
+ switch(ost->st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
do_audio_out(os, ost, ist, data_buf, data_size);
break;
@@ -1386,12 +1386,12 @@
/* force the input stream PTS */
avcodec_get_frame_defaults(&avframe);
- ost->st->codec.coded_frame= &avframe;
+ ost->st->codec->coded_frame= &avframe;
avframe.key_frame = pkt->flags & PKT_FLAG_KEY;
- if(ost->st->codec.codec_type == CODEC_TYPE_AUDIO)
+ if(ost->st->codec->codec_type == CODEC_TYPE_AUDIO)
audio_size += data_size;
- else if (ost->st->codec.codec_type == CODEC_TYPE_VIDEO) {
+ else if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO) {
video_size += data_size;
ost->sync_opts++;
}
@@ -1411,10 +1411,10 @@
opkt.dts= av_rescale_q(dts + input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ost->st->time_base);
}
opkt.flags= pkt->flags;
- if(av_parser_change(ist->st->parser, &ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & PKT_FLAG_KEY))
+ if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & PKT_FLAG_KEY))
opkt.destruct= av_destruct_packet;
av_interleaved_write_frame(os, &opkt);
- ost->st->codec.frame_number++;
+ ost->st->codec->frame_number++;
ost->frame_number++;
av_free_packet(&opkt);
}
@@ -1441,12 +1441,12 @@
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->source_index == ist_index) {
- AVCodecContext *enc= &ost->st->codec;
+ AVCodecContext *enc= ost->st->codec;
os = output_files[ost->file_index];
- if(ost->st->codec.codec_type == CODEC_TYPE_AUDIO && enc->frame_size <=1)
+ if(ost->st->codec->codec_type == CODEC_TYPE_AUDIO && enc->frame_size <=1)
continue;
- if(ost->st->codec.codec_type == CODEC_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
+ if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
continue;
if (ost->encoding_needed) {
@@ -1455,7 +1455,7 @@
av_init_packet(&pkt);
pkt.stream_index= ost->index;
- switch(ost->st->codec.codec_type) {
+ switch(ost->st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL);
audio_size += ret;
@@ -1546,7 +1546,7 @@
ist->discard = 1; /* the stream is discarded by default
(changed later) */
- if (ist->st->codec.rate_emu) {
+ if (ist->st->codec->rate_emu) {
ist->start = av_gettime();
ist->frame = 0;
}
@@ -1607,7 +1607,7 @@
stream_maps[n-1].stream_index;
/* Sanity check that the stream types match */
- if (ist_table[ost->source_index]->st->codec.codec_type != ost->st->codec.codec_type) {
+ if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) {
fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
stream_maps[n-1].file_index, stream_maps[n-1].stream_index,
ost->file_index, ost->index);
@@ -1620,7 +1620,7 @@
for(j=0;j<nb_istreams;j++) {
ist = ist_table[j];
if (ist->discard &&
- ist->st->codec.codec_type == ost->st->codec.codec_type) {
+ ist->st->codec->codec_type == ost->st->codec->codec_type) {
ost->source_index = j;
found = 1;
break;
@@ -1631,7 +1631,7 @@
/* try again and reuse existing stream */
for(j=0;j<nb_istreams;j++) {
ist = ist_table[j];
- if (ist->st->codec.codec_type == ost->st->codec.codec_type) {
+ if (ist->st->codec->codec_type == ost->st->codec->codec_type) {
ost->source_index = j;
found = 1;
}
@@ -1656,8 +1656,8 @@
ost = ost_table[i];
ist = ist_table[ost->source_index];
- codec = &ost->st->codec;
- icodec = &ist->st->codec;
+ codec = ost->st->codec;
+ icodec = ist->st->codec;
if (ost->st->stream_copy) {
/* if stream_copy is selected, no need to decode or encode */
@@ -1773,8 +1773,8 @@
goto fail;
ost->img_resample_ctx = img_resample_full_init(
- ost->st->codec.width, ost->st->codec.height,
- ist->st->codec.width, ist->st->codec.height,
+ ost->st->codec->width, ost->st->codec->height,
+ ist->st->codec->width, ist->st->codec->height,
frame_topBand, frame_bottomBand,
frame_leftBand, frame_rightBand,
frame_padtop, frame_padbottom,
@@ -1877,18 +1877,18 @@
ost = ost_table[i];
if (ost->encoding_needed) {
AVCodec *codec;
- codec = avcodec_find_encoder(ost->st->codec.codec_id);
+ codec = avcodec_find_encoder(ost->st->codec->codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec for output stream #%d.%d\n",
ost->file_index, ost->index);
exit(1);
}
- if (avcodec_open(&ost->st->codec, codec) < 0) {
+ if (avcodec_open(ost->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\n",
ost->file_index, ost->index);
exit(1);
}
- extra_size += ost->st->codec.extradata_size;
+ extra_size += ost->st->codec->extradata_size;
}
}
@@ -1897,19 +1897,19 @@
ist = ist_table[i];
if (ist->decoding_needed) {
AVCodec *codec;
- codec = avcodec_find_decoder(ist->st->codec.codec_id);
+ codec = avcodec_find_decoder(ist->st->codec->codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec (id=%d) for input stream #%d.%d\n",
- ist->st->codec.codec_id, ist->file_index, ist->index);
+ ist->st->codec->codec_id, ist->file_index, ist->index);
exit(1);
}
- if (avcodec_open(&ist->st->codec, codec) < 0) {
+ if (avcodec_open(ist->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for input stream #%d.%d\n",
ist->file_index, ist->index);
exit(1);
}
- //if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO)
- // ist->st->codec.flags |= CODEC_FLAG_REPEAT_FIELD;
+ //if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO)
+ // ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD;
}
}
@@ -2010,8 +2010,8 @@
ost = ost_table[i];
os = output_files[ost->file_index];
ist = ist_table[ost->source_index];
- if(ost->st->codec.codec_type == CODEC_TYPE_VIDEO)
- opts = ost->sync_opts * av_q2d(ost->st->codec.time_base);
+ if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
+ opts = ost->sync_opts * av_q2d(ost->st->codec->time_base);
else
opts = ost->st->pts.val * av_q2d(ost->st->time_base);
ipts = (double)ist->pts;
@@ -2025,7 +2025,7 @@
if(!input_sync) file_index = ist->file_index;
}
}
- if(ost->frame_number >= max_frames[ost->st->codec.codec_type]){
+ if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){
file_index= -1;
break;
}
@@ -2067,7 +2067,7 @@
if (ist->discard)
goto discard_packet;
-// fprintf(stderr, "next:%lld dts:%lld off:%lld %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec.codec_type);
+// fprintf(stderr, "next:%lld dts:%lld off:%lld %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE) {
int64_t delta= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q) - ist->next_pts;
if(ABS(delta) > 10LL*AV_TIME_BASE && !copy_ts){
@@ -2123,8 +2123,8 @@
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->encoding_needed) {
- av_freep(&ost->st->codec.stats_in);
- avcodec_close(&ost->st->codec);
+ av_freep(&ost->st->codec->stats_in);
+ avcodec_close(ost->st->codec);
}
}
@@ -2132,7 +2132,7 @@
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
- avcodec_close(&ist->st->codec);
+ avcodec_close(ist->st->codec);
}
}
@@ -3058,7 +3058,7 @@
/* update the current parameters so that they match the one of the input stream */
for(i=0;i<ic->nb_streams;i++) {
- AVCodecContext *enc = &ic->streams[i]->codec;
+ AVCodecContext *enc = ic->streams[i]->codec;
#if defined(HAVE_THREADS)
if(thread_count>1)
avcodec_thread_init(enc, thread_count);
@@ -3154,7 +3154,7 @@
for(j=0;j<nb_input_files;j++) {
ic = input_files[j];
for(i=0;i<ic->nb_streams;i++) {
- AVCodecContext *enc = &ic->streams[i]->codec;
+ AVCodecContext *enc = ic->streams[i]->codec;
switch(enc->codec_type) {
case CODEC_TYPE_AUDIO:
has_audio = 1;
@@ -3187,10 +3187,10 @@
}
#if defined(HAVE_THREADS)
if(thread_count>1)
- avcodec_thread_init(&st->codec, thread_count);
+ avcodec_thread_init(st->codec, thread_count);
#endif
- video_enc = &st->codec;
+ video_enc = st->codec;
if(video_codec_tag)
video_enc->codec_tag= video_codec_tag;
@@ -3473,10 +3473,10 @@
}
#if defined(HAVE_THREADS)
if(thread_count>1)
- avcodec_thread_init(&st->codec, thread_count);
+ avcodec_thread_init(st->codec, thread_count);
#endif
- audio_enc = &st->codec;
+ audio_enc = st->codec;
audio_enc->codec_type = CODEC_TYPE_AUDIO;
if(audio_codec_tag)
@@ -3535,7 +3535,7 @@
exit(1);
}
- subtitle_enc = &st->codec;
+ subtitle_enc = st->codec;
subtitle_enc->codec_type = CODEC_TYPE_SUBTITLE;
if (subtitle_stream_copy) {
st->stream_copy = 1;
@@ -3732,7 +3732,7 @@
for(j=0;j<nb_output_files;j++) {
oc = output_files[j];
for(i=0;i<oc->nb_streams;i++) {
- AVCodecContext *enc = &oc->streams[i]->codec;
+ AVCodecContext *enc = oc->streams[i]->codec;
switch(enc->codec_type) {
case CODEC_TYPE_AUDIO:
if (enc->sample_rate > ap->sample_rate)
@@ -4041,7 +4041,7 @@
int i, j;
for(j = 0; j < nb_input_files; j++) {
for(i = 0; i < input_files[j]->nb_streams; i++) {
- AVCodecContext *c = &input_files[j]->streams[i]->codec;
+ AVCodecContext *c = input_files[j]->streams[i]->codec;
if(c->codec_type != CODEC_TYPE_VIDEO)
continue;
fr = c->time_base.den * 1000 / c->time_base.num;
Index: output_example.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/output_example.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- output_example.c 8 Jul 2005 10:08:59 -0000 1.14
+++ output_example.c 17 Jul 2005 22:24:35 -0000 1.15
@@ -62,7 +62,7 @@
exit(1);
}
- c = &st->codec;
+ c = st->codec;
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_AUDIO;
@@ -78,7 +78,7 @@
AVCodecContext *c;
AVCodec *codec;
- c = &st->codec;
+ c = st->codec;
/* find the audio encoder */
codec = avcodec_find_encoder(c->codec_id);
@@ -106,7 +106,7 @@
support to compute the input frame size in samples */
if (c->frame_size <= 1) {
audio_input_frame_size = audio_outbuf_size / c->channels;
- switch(st->codec.codec_id) {
+ switch(st->codec->codec_id) {
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
@@ -145,7 +145,7 @@
AVPacket pkt;
av_init_packet(&pkt);
- c = &st->codec;
+ c = st->codec;
get_audio_frame(samples, audio_input_frame_size, c->channels);
@@ -165,7 +165,7 @@
void close_audio(AVFormatContext *oc, AVStream *st)
{
- avcodec_close(&st->codec);
+ avcodec_close(st->codec);
av_free(samples);
av_free(audio_outbuf);
@@ -190,7 +190,7 @@
exit(1);
}
- c = &st->codec;
+ c = st->codec;
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_VIDEO;
@@ -246,7 +246,7 @@
AVCodec *codec;
AVCodecContext *c;
- c = &st->codec;
+ c = st->codec;
/* find the video encoder */
codec = avcodec_find_encoder(c->codec_id);
@@ -317,7 +317,7 @@
int out_size, ret;
AVCodecContext *c;
- c = &st->codec;
+ c = st->codec;
if (frame_count >= STREAM_NB_FRAMES) {
/* no more frame to compress. The codec has a latency of a few
@@ -379,7 +379,7 @@
void close_video(AVFormatContext *oc, AVStream *st)
{
- avcodec_close(&st->codec);
+ avcodec_close(st->codec);
av_free(picture->data[0]);
av_free(picture);
if (tmp_picture) {
Index: ffplay.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/ffplay.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- ffplay.c 17 Jul 2005 10:18:10 -0000 1.47
+++ ffplay.c 17 Jul 2005 22:24:35 -0000 1.48
@@ -381,24 +381,24 @@
vp = &is->pictq[is->pictq_rindex];
if (vp->bmp) {
/* XXX: use variable in the frame */
- if (is->video_st->codec.sample_aspect_ratio.num == 0)
+ if (is->video_st->codec->sample_aspect_ratio.num == 0)
aspect_ratio = 0;
else
- aspect_ratio = av_q2d(is->video_st->codec.sample_aspect_ratio)
- * is->video_st->codec.width / is->video_st->codec.height;;
+ aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio)
+ * is->video_st->codec->width / is->video_st->codec->height;;
if (aspect_ratio <= 0.0)
- aspect_ratio = (float)is->video_st->codec.width /
- (float)is->video_st->codec.height;
+ aspect_ratio = (float)is->video_st->codec->width /
+ (float)is->video_st->codec->height;
/* if an active format is indicated, then it overrides the
mpeg format */
#if 0
- if (is->video_st->codec.dtg_active_format != is->dtg_active_format) {
- is->dtg_active_format = is->video_st->codec.dtg_active_format;
+ if (is->video_st->codec->dtg_active_format != is->dtg_active_format) {
+ is->dtg_active_format = is->video_st->codec->dtg_active_format;
printf("dtg_active_format=%d\n", is->dtg_active_format);
}
#endif
#if 0
- switch(is->video_st->codec.dtg_active_format) {
+ switch(is->video_st->codec->dtg_active_format) {
case FF_DTG_AFD_SAME:
default:
/* nothing to do */
@@ -469,7 +469,7 @@
int16_t time_diff;
/* compute display index : center on currently output samples */
- channels = s->audio_st->codec.channels;
+ channels = s->audio_st->codec->channels;
nb_display_channels = channels;
if (!s->paused) {
n = 2 * channels;
@@ -480,7 +480,7 @@
the last buffer computation */
if (audio_callback_time) {
time_diff = av_gettime() - audio_callback_time;
- delay += (time_diff * s->audio_st->codec.sample_rate) / 1000000;
+ delay += (time_diff * s->audio_st->codec->sample_rate) / 1000000;
}
delay -= s->width / 2;
@@ -567,8 +567,8 @@
hw_buf_size = audio_write_get_buf_size(is);
bytes_per_sec = 0;
if (is->audio_st) {
- bytes_per_sec = is->audio_st->codec.sample_rate *
- 2 * is->audio_st->codec.channels;
+ bytes_per_sec = is->audio_st->codec->sample_rate *
+ 2 * is->audio_st->codec->channels;
}
if (bytes_per_sec)
pts -= (double)hw_buf_size / bytes_per_sec;
@@ -767,7 +767,7 @@
#if 0
/* XXX: use generic function */
/* XXX: disable overlay if no hardware acceleration or if RGB format */
- switch(is->video_st->codec.pix_fmt) {
+ switch(is->video_st->codec->pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P:
case PIX_FMT_YUV444P:
@@ -781,12 +781,12 @@
break;
}
#endif
- vp->bmp = SDL_CreateYUVOverlay(is->video_st->codec.width,
- is->video_st->codec.height,
+ vp->bmp = SDL_CreateYUVOverlay(is->video_st->codec->width,
+ is->video_st->codec->height,
SDL_YV12_OVERLAY,
screen);
- vp->width = is->video_st->codec.width;
- vp->height = is->video_st->codec.height;
+ vp->width = is->video_st->codec->width;
+ vp->height = is->video_st->codec->height;
SDL_LockMutex(is->pictq_mutex);
vp->allocated = 1;
@@ -815,8 +815,8 @@
/* alloc or resize hardware picture buffer */
if (!vp->bmp ||
- vp->width != is->video_st->codec.width ||
- vp->height != is->video_st->codec.height) {
+ vp->width != is->video_st->codec->width ||
+ vp->height != is->video_st->codec->height) {
SDL_Event event;
vp->allocated = 0;
@@ -852,8 +852,8 @@
pict.linesize[1] = vp->bmp->pitches[2];
pict.linesize[2] = vp->bmp->pitches[1];
img_convert(&pict, dst_pix_fmt,
- (AVPicture *)src_frame, is->video_st->codec.pix_fmt,
- is->video_st->codec.width, is->video_st->codec.height);
+ (AVPicture *)src_frame, is->video_st->codec->pix_fmt,
+ is->video_st->codec->width, is->video_st->codec->height);
/* update the bitmap content */
SDL_UnlockYUVOverlay(vp->bmp);
@@ -883,7 +883,7 @@
pts = is->video_clock;
}
/* update video clock for next frame */
- frame_delay = av_q2d(is->video_st->codec.time_base);
+ frame_delay = av_q2d(is->video_st->codec->time_base);
/* for MPEG2, the frame can be repeated, so we update the
clock accordingly */
if (src_frame->repeat_pict) {
@@ -928,7 +928,7 @@
pts = av_q2d(is->video_st->time_base)*pkt->dts;
SDL_LockMutex(is->video_decoder_mutex);
- len1 = avcodec_decode_video(&is->video_st->codec,
+ len1 = avcodec_decode_video(is->video_st->codec,
frame, &got_picture,
pkt->data, pkt->size);
SDL_UnlockMutex(is->video_decoder_mutex);
@@ -953,7 +953,7 @@
{
int size, len, channels;
- channels = is->audio_st->codec.channels;
+ channels = is->audio_st->codec->channels;
size = samples_size / sizeof(short);
while (size > 0) {
@@ -977,7 +977,7 @@
int n, samples_size;
double ref_clock;
- n = 2 * is->audio_st->codec.channels;
+ n = 2 * is->audio_st->codec->channels;
samples_size = samples_size1;
/* if not master, then we try to remove or add samples to correct the clock */
@@ -999,7 +999,7 @@
avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef);
if (fabs(avg_diff) >= is->audio_diff_threshold) {
- wanted_size = samples_size + ((int)(diff * is->audio_st->codec.sample_rate) * n);
+ wanted_size = samples_size + ((int)(diff * is->audio_st->codec->sample_rate) * n);
nb_samples = samples_size / n;
min_size = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n;
@@ -1057,7 +1057,7 @@
/* NOTE: the audio packet can contain several frames */
while (is->audio_pkt_size > 0) {
SDL_LockMutex(is->audio_decoder_mutex);
- len1 = avcodec_decode_audio(&is->audio_st->codec,
+ len1 = avcodec_decode_audio(is->audio_st->codec,
(int16_t *)audio_buf, &data_size,
is->audio_pkt_data, is->audio_pkt_size);
SDL_UnlockMutex(is->audio_decoder_mutex);
@@ -1074,9 +1074,9 @@
/* if no pts, then compute it */
pts = is->audio_clock;
*pts_ptr = pts;
- n = 2 * is->audio_st->codec.channels;
+ n = 2 * is->audio_st->codec->channels;
is->audio_clock += (double)data_size /
- (double)(n * is->audio_st->codec.sample_rate);
+ (double)(n * is->audio_st->codec->sample_rate);
#if defined(DEBUG_SYNC)
{
static double last_clock;
@@ -1164,7 +1164,7 @@
if (stream_index < 0 || stream_index >= ic->nb_streams)
return -1;
- enc = &ic->streams[stream_index]->codec;
+ enc = ic->streams[stream_index]->codec;
/* prepare audio output */
if (enc->codec_type == CODEC_TYPE_AUDIO) {
@@ -1248,7 +1248,7 @@
AVFormatContext *ic = is->ic;
AVCodecContext *enc;
- enc = &ic->streams[stream_index]->codec;
+ enc = ic->streams[stream_index]->codec;
switch(enc->codec_type) {
case CODEC_TYPE_AUDIO:
@@ -1387,7 +1387,7 @@
}
for(i = 0; i < ic->nb_streams; i++) {
- AVCodecContext *enc = &ic->streams[i]->codec;
+ AVCodecContext *enc = ic->streams[i]->codec;
switch(enc->codec_type) {
case CODEC_TYPE_AUDIO:
if (audio_index < 0 && !audio_disable)
@@ -1455,7 +1455,7 @@
}
if (is->video_stream >= 0) {
packet_queue_flush(&is->videoq);
- avcodec_flush_buffers(&ic->streams[video_index]->codec);
+ avcodec_flush_buffers(ic->streams[video_index]->codec);
}
}
SDL_UnlockMutex(is->audio_decoder_mutex);
@@ -1594,12 +1594,12 @@
if (stream_index == start_index)
return;
st = ic->streams[stream_index];
- if (st->codec.codec_type == codec_type) {
+ if (st->codec->codec_type == codec_type) {
/* check that parameters are OK */
switch(codec_type) {
case CODEC_TYPE_AUDIO:
- if (st->codec.sample_rate != 0 &&
- st->codec.channels != 0)
+ if (st->codec->sample_rate != 0 &&
+ st->codec->channels != 0)
goto the_end;
break;
case CODEC_TYPE_VIDEO:
Index: ffserver.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/ffserver.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- ffserver.c 7 May 2005 00:56:05 -0000 1.93
+++ ffserver.c 17 Jul 2005 22:24:35 -0000 1.94
@@ -728,8 +728,8 @@
/* close each frame parser */
for(i=0;i<c->fmt_in->nb_streams;i++) {
st = c->fmt_in->streams[i];
- if (st->codec.codec) {
- avcodec_close(&st->codec);
+ if (st->codec->codec) {
+ avcodec_close(st->codec);
}
}
av_close_input_file(c->fmt_in);
@@ -1002,7 +1002,7 @@
int best = -1;
for (i = 0; i < feed->nb_streams; i++) {
- AVCodecContext *feed_codec = &feed->streams[i]->codec;
+ AVCodecContext *feed_codec = feed->streams[i]->codec;
if (feed_codec->codec_id != codec->codec_id ||
feed_codec->sample_rate != codec->sample_rate ||
@@ -1044,7 +1044,7 @@
return 0;
for (i = 0; i < req->nb_streams; i++) {
- AVCodecContext *codec = &req->streams[i]->codec;
+ AVCodecContext *codec = req->streams[i]->codec;
switch(rates[i]) {
case 0:
@@ -1659,10 +1659,10 @@
for(i=0;i<stream->nb_streams;i++) {
AVStream *st = stream->streams[i];
- AVCodec *codec = avcodec_find_encoder(st->codec.codec_id);
- switch(st->codec.codec_type) {
+ AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
+ switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
- audio_bit_rate += st->codec.bit_rate;
+ audio_bit_rate += st->codec->bit_rate;
if (codec) {
if (*audio_codec_name)
audio_codec_name_extra = "...";
@@ -1670,7 +1670,7 @@
}
break;
case CODEC_TYPE_VIDEO:
- video_bit_rate += st->codec.bit_rate;
+ video_bit_rate += st->codec->bit_rate;
if (codec) {
if (*video_codec_name)
video_codec_name_extra = "...";
@@ -1678,7 +1678,7 @@
}
break;
case CODEC_TYPE_DATA:
- video_bit_rate += st->codec.bit_rate;
+ video_bit_rate += st->codec->bit_rate;
break;
default:
av_abort();
@@ -1744,26 +1744,26 @@
for (i = 0; i < stream->nb_streams; i++) {
AVStream *st = stream->streams[i];
- AVCodec *codec = avcodec_find_encoder(st->codec.codec_id);
+ AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
const char *type = "unknown";
char parameters[64];
parameters[0] = 0;
- switch(st->codec.codec_type) {
+ switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
type = "audio";
break;
case CODEC_TYPE_VIDEO:
type = "video";
- snprintf(parameters, sizeof(parameters), "%dx%d, q=%d-%d, fps=%d", st->codec.width, st->codec.height,
- st->codec.qmin, st->codec.qmax, st->codec.time_base.den / st->codec.time_base.num);
+ snprintf(parameters, sizeof(parameters), "%dx%d, q=%d-%d, fps=%d", st->codec->width, st->codec->height,
+ st->codec->qmin, st->codec->qmax, st->codec->time_base.den / st->codec->time_base.num);
break;
default:
av_abort();
}
url_fprintf(pb, "<tr><td align=right>%d<td>%s<td align=right>%d<td>%s<td>%s\n",
- i, type, st->codec.bit_rate/1000, codec ? codec->name : "", parameters);
+ i, type, st->codec->bit_rate/1000, codec ? codec->name : "", parameters);
}
url_fprintf(pb, "</table>\n");
@@ -1786,7 +1786,7 @@
for(i=0;i<stream->nb_streams;i++) {
AVStream *st = stream->streams[i];
FeedData *fdata = st->priv_data;
- enc = &st->codec;
+ enc = st->codec;
avcodec_string(buf, sizeof(buf), enc);
avg = fdata->avg_frame_size * (float)enc->rate * 8.0;
@@ -1822,10 +1822,10 @@
if (c1->stream) {
for (j = 0; j < c1->stream->nb_streams; j++) {
if (!c1->stream->feed) {
- bitrate += c1->stream->streams[j]->codec.bit_rate;
+ bitrate += c1->stream->streams[j]->codec->bit_rate;
} else {
if (c1->feed_streams[j] >= 0) {
- bitrate += c1->stream->feed->streams[c1->feed_streams[j]]->codec.bit_rate;
+ bitrate += c1->stream->feed->streams[c1->feed_streams[j]]->codec->bit_rate;
}
}
}
@@ -1867,12 +1867,12 @@
AVStream *st = s->streams[i];
AVCodec *codec;
- if (!st->codec.codec) {
- codec = avcodec_find_decoder(st->codec.codec_id);
+ if (!st->codec->codec) {
+ codec = avcodec_find_decoder(st->codec->codec_id);
if (codec && (codec->capabilities & CODEC_CAP_PARSE_ONLY)) {
- st->codec.parse_only = 1;
- if (avcodec_open(&st->codec, codec) < 0) {
- st->codec.parse_only = 0;
+ st->codec->parse_only = 1;
+ if (avcodec_open(st->codec, codec) < 0) {
+ st->codec->parse_only = 0;
}
}
}
@@ -1935,7 +1935,7 @@
c->pts_stream_index = 0;
for(i=0;i<c->stream->nb_streams;i++) {
if (c->pts_stream_index == 0 &&
- c->stream->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO) {
+ c->stream->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
c->pts_stream_index = i;
}
}
@@ -2010,12 +2010,12 @@
*st = *src;
st->priv_data = 0;
- st->codec.frame_number = 0; /* XXX: should be done in
+ st->codec->frame_number = 0; /* XXX: should be done in
AVStream, not in codec */
/* I'm pretty sure that this is not correct...
* However, without it, we crash
*/
- st->codec.coded_frame = &dummy_frame;
+ st->codec->coded_frame = &dummy_frame;
}
c->got_key_frame = 0;
@@ -2144,13 +2144,13 @@
av_free_packet(&pkt);
break;
}
- codec = &ctx->streams[0]->codec;
+ codec = ctx->streams[0]->codec;
/* only one stream per RTP connection */
pkt.stream_index = 0;
} else {
ctx = &c->fmt_ctx;
/* Fudge here */
- codec = &ctx->streams[pkt.stream_index]->codec;
+ codec = ctx->streams[pkt.stream_index]->codec;
}
codec->coded_frame->key_frame = ((pkt.flags & PKT_FLAG_KEY) != 0);
@@ -2462,8 +2462,8 @@
goto fail;
}
for (i = 0; i < s.nb_streams; i++) {
- memcpy(&feed->streams[i]->codec,
- &s.streams[i]->codec, sizeof(AVCodecContext));
+ memcpy(feed->streams[i]->codec,
+ s.streams[i]->codec, sizeof(AVCodecContext));
}
av_freep(&s.priv_data);
}
@@ -2638,10 +2638,10 @@
private_payload_type = RTP_PT_PRIVATE;
for(i = 0; i < stream->nb_streams; i++) {
st = stream->streams[i];
- if (st->codec.codec_id == CODEC_ID_MPEG2TS) {
+ if (st->codec->codec_id == CODEC_ID_MPEG2TS) {
mediatype = "video";
} else {
- switch(st->codec.codec_type) {
+ switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
mediatype = "audio";
break;
@@ -2655,7 +2655,7 @@
}
/* NOTE: the port indication is not correct in case of
unicast. It is not an issue because RTSP gives it */
- payload_type = rtp_get_payload_type(&st->codec);
+ payload_type = rtp_get_payload_type(st->codec);
if (payload_type < 0)
payload_type = private_payload_type++;
if (stream->is_multicast) {
@@ -2667,17 +2667,17 @@
mediatype, port, payload_type);
if (payload_type >= RTP_PT_PRIVATE) {
/* for private payload type, we need to give more info */
- switch(st->codec.codec_id) {
+ switch(st->codec->codec_id) {
case CODEC_ID_MPEG4:
{
uint8_t *data;
url_fprintf(pb, "a=rtpmap:%d MP4V-ES/%d\n",
payload_type, 90000);
/* we must also add the mpeg4 header */
- data = st->codec.extradata;
+ data = st->codec->extradata;
if (data) {
url_fprintf(pb, "a=fmtp:%d config=", payload_type);
- for(j=0;j<st->codec.extradata_size;j++) {
+ for(j=0;j<st->codec->extradata_size;j++) {
url_fprintf(pb, "%02x", data[j]);
}
url_fprintf(pb, "\n");
@@ -3222,8 +3222,8 @@
if (!fst)
return NULL;
fst->priv_data = av_mallocz(sizeof(FeedData));
- memcpy(&fst->codec, codec, sizeof(AVCodecContext));
- fst->codec.coded_frame = &dummy_frame;
+ memcpy(fst->codec, codec, sizeof(AVCodecContext));
+ fst->codec->coded_frame = &dummy_frame;
fst->index = stream->nb_streams;
av_set_pts_info(fst, 33, 1, 90000);
stream->streams[stream->nb_streams++] = fst;
@@ -3237,10 +3237,10 @@
AVCodecContext *av, *av1;
int i;
- av = &st->codec;
+ av = st->codec;
for(i=0;i<feed->nb_streams;i++) {
st = feed->streams[i];
- av1 = &st->codec;
+ av1 = st->codec;
if (av1->codec_id == av->codec_id &&
av1->codec_type == av->codec_type &&
av1->bit_rate == av->bit_rate) {
@@ -3297,8 +3297,8 @@
mpeg4_count = 0;
for(i=0;i<infile->nb_streams;i++) {
st = infile->streams[i];
- if (st->codec.codec_id == CODEC_ID_MPEG4 &&
- st->codec.extradata_size == 0) {
+ if (st->codec->codec_id == CODEC_ID_MPEG4 &&
+ st->codec->extradata_size == 0) {
mpeg4_count++;
}
}
@@ -3310,9 +3310,9 @@
if (av_read_packet(infile, &pkt) < 0)
break;
st = infile->streams[pkt.stream_index];
- if (st->codec.codec_id == CODEC_ID_MPEG4 &&
- st->codec.extradata_size == 0) {
- av_freep(&st->codec.extradata);
+ if (st->codec->codec_id == CODEC_ID_MPEG4 &&
+ st->codec->extradata_size == 0) {
+ av_freep(&st->codec->extradata);
/* fill extradata with the header */
/* XXX: we make hard suppositions here ! */
p = pkt.data;
@@ -3322,9 +3322,9 @@
p[2] == 0x01 && p[3] == 0xb6) {
size = p - pkt.data;
// av_hex_dump(pkt.data, size);
- st->codec.extradata = av_malloc(size);
- st->codec.extradata_size = size;
- memcpy(st->codec.extradata, pkt.data, size);
+ st->codec->extradata = av_malloc(size);
+ st->codec->extradata_size = size;
+ memcpy(st->codec->extradata, pkt.data, size);
break;
}
p++;
@@ -3376,7 +3376,7 @@
extract_mpeg4_header(infile);
for(i=0;i<infile->nb_streams;i++) {
- add_av_stream1(stream, &infile->streams[i]->codec);
+ add_av_stream1(stream, infile->streams[i]->codec);
}
av_close_input_file(infile);
}
@@ -3441,8 +3441,8 @@
} else {
AVCodecContext *ccf, *ccs;
- ccf = &sf->codec;
- ccs = &ss->codec;
+ ccf = sf->codec;
+ ccs = ss->codec;
#define CHECK_CODEC(x) (ccf->x != ccs->x)
if (CHECK_CODEC(codec) || CHECK_CODEC(codec_type)) {
@@ -3550,10 +3550,10 @@
bandwidth = 0;
for(i=0;i<stream->nb_streams;i++) {
AVStream *st = stream->streams[i];
- switch(st->codec.codec_type) {
+ switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
case CODEC_TYPE_VIDEO:
- bandwidth += st->codec.bit_rate;
+ bandwidth += st->codec->bit_rate;
break;
default:
break;
@@ -3665,7 +3665,7 @@
if (!st)
return;
stream->streams[stream->nb_streams++] = st;
- memcpy(&st->codec, av, sizeof(AVCodecContext));
+ memcpy(st->codec, av, sizeof(AVCodecContext));
}
static int opt_audio_codec(const char *arg)
- Previous message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mjpeg.c,1.110,1.111
- Next message: [Ffmpeg-cvslog] CVS: ffmpeg ffmpeg.c, 1.338, 1.339 output_example.c, 1.14, 1.15 ffplay.c, 1.47, 1.48 ffserver.c, 1.93, 1.94
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ffmpeg-cvslog
mailing list