Commit 01f4895c authored by Michael Niedermayer's avatar Michael Niedermayer

changing AVCodecContext codec -> *codec in AVStream so additions to...

changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility

Originally committed as revision 4453 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 4c1a012e
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -166,11 +166,11 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_4XM;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = fourxm->width;
st->codec.height = fourxm->height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_4XM;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = fourxm->width;
st->codec->height = fourxm->height;
} else if (fourcc_tag == strk_TAG) {
/* check that there is enough data */
......@@ -205,20 +205,20 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->tracks[current_track].stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = 1;
st->codec.channels = fourxm->tracks[current_track].channels;
st->codec.sample_rate = fourxm->tracks[current_track].sample_rate;
st->codec.bits_per_sample = fourxm->tracks[current_track].bits;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample;
st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = 1;
st->codec->channels = fourxm->tracks[current_track].channels;
st->codec->sample_rate = fourxm->tracks[current_track].sample_rate;
st->codec->bits_per_sample = fourxm->tracks[current_track].bits;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
if (fourxm->tracks[current_track].adpcm)
st->codec.codec_id = CODEC_ID_ADPCM_4XM;
else if (st->codec.bits_per_sample == 8)
st->codec.codec_id = CODEC_ID_PCM_U8;
st->codec->codec_id = CODEC_ID_ADPCM_4XM;
else if (st->codec->bits_per_sample == 8)
st->codec->codec_id = CODEC_ID_PCM_U8;
else
st->codec.codec_id = CODEC_ID_PCM_S16LE;
st->codec->codec_id = CODEC_ID_PCM_S16LE;
}
}
......
......@@ -31,7 +31,7 @@ static const unsigned char AMRWB_header [] = "#!AMR-WB\n";
static int amr_write_header(AVFormatContext *s)
{
ByteIOContext *pb = &s->pb;
AVCodecContext *enc = &s->streams[0]->codec;
AVCodecContext *enc = s->streams[0]->codec;
s->priv_data = NULL;
......@@ -100,11 +100,11 @@ static int amr_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
}
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = MKTAG('s', 'a', 'w', 'b');
st->codec.codec_id = CODEC_ID_AMR_WB;
st->codec.channels = 1;
st->codec.sample_rate = 16000;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b');
st->codec->codec_id = CODEC_ID_AMR_WB;
st->codec->channels = 1;
st->codec->sample_rate = 16000;
}
else
{
......@@ -114,11 +114,11 @@ static int amr_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
}
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = MKTAG('s', 'a', 'm', 'r');
st->codec.codec_id = CODEC_ID_AMR_NB;
st->codec.channels = 1;
st->codec.sample_rate = 8000;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
st->codec->codec_id = CODEC_ID_AMR_NB;
st->codec->channels = 1;
st->codec->sample_rate = 8000;
}
return 0;
......@@ -129,7 +129,7 @@ static int amr_read_header(AVFormatContext *s,
static int amr_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
AVCodecContext *enc = &s->streams[0]->codec;
AVCodecContext *enc = s->streams[0]->codec;
if (enc->codec_id == CODEC_ID_AMR_NB)
{
......
......@@ -289,7 +289,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
bit_rate = 0;
for(n=0;n<s->nb_streams;n++) {
enc = &s->streams[n]->codec;
enc = s->streams[n]->codec;
av_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */
......@@ -353,7 +353,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
int er_spr_len = 0;
// ASFStream *stream = &asf->streams[n];
enc = &s->streams[n]->codec;
enc = s->streams[n]->codec;
asf->streams[n].num = n + 1;
asf->streams[n].seq = 0;
......@@ -437,7 +437,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
for(n=0;n<s->nb_streams;n++) {
AVCodec *p;
enc = &s->streams[n]->codec;
enc = s->streams[n]->codec;
p = avcodec_find_encoder(enc->codec_id);
put_le16(pb, asf->streams[n].num);
......@@ -730,7 +730,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t packet_st,pts;
int start_sec,i;
codec = &s->streams[pkt->stream_index]->codec;
codec = s->streams[pkt->stream_index]->codec;
stream = &asf->streams[pkt->stream_index];
//XXX /FIXME use duration from AVPacket (quick hack by)
......
......@@ -216,9 +216,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
asf->asfid2avid[st->id] = s->nb_streams - 1;
get_le32(pb);
st->codec.codec_type = type;
st->codec->codec_type = type;
if (type == CODEC_TYPE_AUDIO) {
get_wav_header(pb, &st->codec, type_specific_size);
get_wav_header(pb, st->codec, type_specific_size);
st->need_parsing = 1;
/* We have to init the frame size at some point .... */
pos2 = url_ftell(pb);
......@@ -237,9 +237,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1))
asf_st->ds_span = 0; // disable descrambling
}
switch (st->codec.codec_id) {
switch (st->codec->codec_id) {
case CODEC_ID_MP3:
st->codec.frame_size = MPA_FRAME_SIZE;
st->codec->frame_size = MPA_FRAME_SIZE;
break;
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
......@@ -249,11 +249,11 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW:
st->codec.frame_size = 1;
st->codec->frame_size = 1;
break;
default:
/* This is probably wrong, but it prevents a crash later */
st->codec.frame_size = 1;
st->codec->frame_size = 1;
break;
}
} else {
......@@ -262,38 +262,38 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_byte(pb);
size = get_le16(pb); /* size */
sizeX= get_le32(pb); /* size */
st->codec.width = get_le32(pb);
st->codec.height = get_le32(pb);
st->codec->width = get_le32(pb);
st->codec->height = get_le32(pb);
/* not available for asf */
get_le16(pb); /* panes */
st->codec.bits_per_sample = get_le16(pb); /* depth */
st->codec->bits_per_sample = get_le16(pb); /* depth */
tag1 = get_le32(pb);
url_fskip(pb, 20);
// av_log(NULL, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
size= sizeX;
if (size > 40) {
st->codec.extradata_size = size - 40;
st->codec.extradata = av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
st->codec->extradata_size = size - 40;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
}
/* Extract palette from extradata if bpp <= 8 */
/* This code assumes that extradata contains only palette */
/* This is true for all paletted codecs implemented in ffmpeg */
if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {
st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));
if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) {
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
#ifdef WORDS_BIGENDIAN
for (i = 0; i < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; i++)
st->codec.palctrl->palette[i] = bswap_32(((uint32_t*)st->codec.extradata)[i]);
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]);
#else
memcpy(st->codec.palctrl->palette, st->codec.extradata,
FFMIN(st->codec.extradata_size, AVPALETTE_SIZE));
memcpy(st->codec->palctrl->palette, st->codec->extradata,
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
#endif
st->codec.palctrl->palette_changed = 1;
st->codec->palctrl->palette_changed = 1;
}
st->codec.codec_tag = tag1;
st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);
st->codec->codec_tag = tag1;
st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
if(tag1 == MKTAG('D', 'V', 'R', ' '))
st->need_parsing = 1;
}
......@@ -398,7 +398,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st = s->streams[i];
if (st) {
av_free(st->priv_data);
av_free(st->codec.extradata);
av_free(st->codec->extradata);
}
av_free(st);
}
......@@ -608,8 +608,8 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
asf_st->packet_pos= asf->packet_pos;
//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & PKT_FLAG_KEY,
//s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size);
if (s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO)
//s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size);
if (s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO)
asf->packet_key_frame = 1;
if (asf->packet_key_frame)
asf_st->pkt.flags |= PKT_FLAG_KEY;
......@@ -666,8 +666,8 @@ static int asf_read_close(AVFormatContext *s)
for(i=0;i<s->nb_streams;i++) {
AVStream *st = s->streams[i];
av_free(st->priv_data);
av_free(st->codec.extradata);
av_free(st->codec.palctrl);
av_free(st->codec->extradata);
av_free(st->codec->palctrl);
}
return 0;
}
......
......@@ -63,7 +63,7 @@ static int au_write_header(AVFormatContext *s)
s->priv_data = NULL;
/* format header */
if (put_au_header(pb, &s->streams[0]->codec) < 0) {
if (put_au_header(pb, s->streams[0]->codec) < 0) {
return -1;
}
......@@ -143,11 +143,11 @@ static int au_read_header(AVFormatContext *s,
st = av_new_stream(s, 0);
if (!st)
return -1;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = id;
st->codec.codec_id = codec;
st->codec.channels = channels;
st->codec.sample_rate = rate;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->sample_rate = rate;
av_set_pts_info(st, 64, 1, rate);
return 0;
}
......
......@@ -162,8 +162,8 @@ static int audio_write_header(AVFormatContext *s1)
int ret;
st = s1->streams[0];
s->sample_rate = st->codec.sample_rate;
s->channels = st->codec.channels;
s->sample_rate = st->codec->sample_rate;
s->channels = st->codec->channels;
ret = audio_open(s, 1, NULL);
if (ret < 0) {
return AVERROR_IO;
......@@ -234,10 +234,10 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
/* take real parameters */
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = s->codec_id;
st->codec.sample_rate = s->sample_rate;
st->codec.channels = s->channels;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = s->codec_id;
st->codec->sample_rate = s->sample_rate;
st->codec->channels = s->channels;
av_set_pts_info(st, 48, 1, 1000000); /* 48 bits pts in us */
return 0;
......
......@@ -5,7 +5,7 @@
extern "C" {
#endif
#define LIBAVFORMAT_BUILD 4628
#define LIBAVFORMAT_BUILD 4629
#define LIBAVFORMAT_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVFORMAT_VERSION FFMPEG_VERSION
......@@ -216,7 +216,7 @@ typedef struct AVIndexEntry {
typedef struct AVStream {
int index; /* stream index in AVFormatContext */
int id; /* format specific stream id */
AVCodecContext codec; /* codec context */
AVCodecContext *codec; /* codec context */
/**
* real base frame rate of the stream.
* for example if the timebase is 1/90000 and all frames have either
......
......@@ -178,7 +178,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto fail;
ast = s->streams[0]->priv_data;
av_freep(&s->streams[0]->codec.extradata);
av_freep(&s->streams[0]->codec->extradata);
av_freep(&s->streams[0]);
s->nb_streams = 0;
avi->dv_demux = dv_init_demux(s);
......@@ -199,7 +199,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
st = s->streams[stream_index];
ast = st->priv_data;
st->codec.stream_codec_tag= handler;
st->codec->stream_codec_tag= handler;
get_le32(pb); /* flags */
get_le16(pb); /* priority */
......@@ -259,10 +259,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
switch(codec_type) {
case CODEC_TYPE_VIDEO:
get_le32(pb); /* size */
st->codec.width = get_le32(pb);
st->codec.height = get_le32(pb);
st->codec->width = get_le32(pb);
st->codec->height = get_le32(pb);
get_le16(pb); /* panes */
st->codec.bits_per_sample= get_le16(pb); /* depth */
st->codec->bits_per_sample= get_le16(pb); /* depth */
tag1 = get_le32(pb);
get_le32(pb); /* ImageSize */
get_le32(pb); /* XPelsPerMeter */
......@@ -271,41 +271,41 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_le32(pb); /* ClrImportant */
if(size > 10*4 && size<(1<<30)){
st->codec.extradata_size= size - 10*4;
st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
st->codec->extradata_size= size - 10*4;
st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
}
if(st->codec.extradata_size & 1) //FIXME check if the encoder really did this correctly
if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
get_byte(pb);
/* Extract palette from extradata if bpp <= 8 */
/* This code assumes that extradata contains only palette */
/* This is true for all paletted codecs implemented in ffmpeg */
if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {
st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));
if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) {
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
#ifdef WORDS_BIGENDIAN
for (i = 0; i < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; i++)
st->codec.palctrl->palette[i] = bswap_32(((uint32_t*)st->codec.extradata)[i]);
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]);
#else
memcpy(st->codec.palctrl->palette, st->codec.extradata,
FFMIN(st->codec.extradata_size, AVPALETTE_SIZE));
memcpy(st->codec->palctrl->palette, st->codec->extradata,
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
#endif
st->codec.palctrl->palette_changed = 1;
st->codec->palctrl->palette_changed = 1;
}
#ifdef DEBUG
print_tag("video", tag1, 0);
#endif
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_tag = tag1;
st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);
if (st->codec.codec_id == CODEC_ID_XAN_WC4)
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_tag = tag1;
st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
if (st->codec->codec_id == CODEC_ID_XAN_WC4)
xan_video = 1;
// url_fskip(pb, size - 5 * 4);
break;
case CODEC_TYPE_AUDIO:
get_wav_header(pb, &st->codec, size);
get_wav_header(pb, st->codec, size);
if (size%2) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
url_fskip(pb, 1);
/* special case time: To support Xan DPCM, hardcode
......@@ -314,12 +314,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* force parsing as several audio frames can be in
one packet */
if (xan_video)
st->codec.codec_id = CODEC_ID_XAN_DPCM;
st->codec->codec_id = CODEC_ID_XAN_DPCM;
break;
default:
st->codec.codec_type = CODEC_TYPE_DATA;
st->codec.codec_id= CODEC_ID_NONE;
st->codec.codec_tag= 0;
st->codec->codec_type = CODEC_TYPE_DATA;
st->codec->codec_id= CODEC_ID_NONE;
st->codec->codec_tag= 0;
url_fskip(pb, size);
break;
}
......@@ -337,7 +337,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (stream_index != s->nb_streams - 1) {
fail:
for(i=0;i<s->nb_streams;i++) {
av_freep(&s->streams[i]->codec.extradata);
av_freep(&s->streams[i]->codec->extradata);
av_freep(&s->streams[i]);
}
return -1;
......@@ -440,7 +440,7 @@ resync:
//av_log(NULL, AV_LOG_DEBUG, "dts:%Ld offset:%d %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, n, size);
pkt->stream_index = avi->stream_index;
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
if(st->index_entries){
AVIndexEntry *e;
int index;
......@@ -580,9 +580,9 @@ resync:
g = get_byte(pb);
b = get_byte(pb);
get_byte(pb);
st->codec.palctrl->palette[k] = b + (g << 8) + (r << 16);
st->codec->palctrl->palette[k] = b + (g << 8) + (r << 16);
}
st->codec.palctrl->palette_changed = 1;
st->codec->palctrl->palette_changed = 1;
goto resync;
}
......@@ -786,8 +786,8 @@ static int avi_read_close(AVFormatContext *s)
AVStream *st = s->streams[i];
AVIStream *ast = st->priv_data;
av_free(ast);
av_free(st->codec.extradata);
av_free(st->codec.palctrl);
av_free(st->codec->extradata);
av_free(st->codec->palctrl);
}
if (avi->dv_demux)
......
......@@ -338,7 +338,7 @@ static int avi_write_header(AVFormatContext *s)
video_enc = NULL;
for(n=0;n<s->nb_streams;n++) {
stream = &s->streams[n]->codec;
stream = s->streams[n]->codec;
bitrate += stream->bit_rate;
if (stream->codec_type == CODEC_TYPE_VIDEO)
video_enc = stream;
......@@ -376,7 +376,7 @@ static int avi_write_header(AVFormatContext *s)
list2 = start_tag(pb, "LIST");
put_tag(pb, "strl");
stream = &s->streams[i]->codec;
stream = s->streams[i]->codec;
/* FourCC should really be set by the codec itself */
if (! stream->codec_tag) {
......@@ -504,7 +504,7 @@ static int avi_write_ix(AVFormatContext *s)
for (i=0;i<s->nb_streams;i++) {
offset_t ix, pos;
avi_stream2fourcc(&tag[0], i, s->streams[i]->codec.codec_type);
avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
ix_tag[3] = '0' + i;
/* Writing AVI OpenDML leaf index chunk */
......@@ -576,7 +576,7 @@ static int avi_write_idx1(AVFormatContext *s)
}
if (!empty) {
avi_stream2fourcc(&tag[0], stream_id,
s->streams[stream_id]->codec.codec_type);
s->streams[stream_id]->codec->codec_type);
put_tag(pb, &tag[0]);
put_le32(pb, ie->flags);
put_le32(pb, ie->pos);
......@@ -591,7 +591,7 @@ static int avi_write_idx1(AVFormatContext *s)
nb_frames = 0;
for(n=0;n<s->nb_streams;n++) {
if (avi->frames_hdr_strm[n] != 0) {
stream = &s->streams[n]->codec;
stream = s->streams[n]->codec;
url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET);
ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
if (au_ssize == 0) {
......@@ -618,7 +618,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
unsigned char tag[5];
unsigned int flags=0;
const int stream_index= pkt->stream_index;
AVCodecContext *enc= &s->streams[stream_index]->codec;
AVCodecContext *enc= s->streams[stream_index]->codec;
int size= pkt->size;
// av_log(s, AV_LOG_DEBUG, "%lld %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index);
......@@ -705,7 +705,7 @@ static int avi_write_trailer(AVFormatContext *s)
url_fskip(pb, 16);
for (n=nb_frames=0;n<s->nb_streams;n++) {
AVCodecContext *stream = &s->streams[n]->codec;
AVCodecContext *stream = s->streams[n]->codec;
if (stream->codec_type == CODEC_TYPE_VIDEO) {
if (nb_frames < stream->frame_number)
nb_frames = stream->frame_number;
......
......@@ -560,8 +560,8 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
if (!c->ast[i])
break;
av_set_pts_info(c->ast[i], 64, 1, 30000);
c->ast[i]->codec.codec_type = CODEC_TYPE_AUDIO;
c->ast[i]->codec.codec_id = CODEC_ID_PCM_S16LE;
c->ast[i]->codec->codec_type = CODEC_TYPE_AUDIO;
c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
av_init_packet(&c->audio_pkt[i]);
c->audio_pkt[i].size = 0;
......@@ -569,9 +569,9 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
c->audio_pkt[i].stream_index = c->ast[i]->index;
c->audio_pkt[i].flags |= PKT_FLAG_KEY;
}
c->ast[i]->codec.sample_rate = dv_audio_frequency[freq];
c->ast[i]->codec.channels = 2;
c->ast[i]->codec.bit_rate = 2 * dv_audio_frequency[freq] * 16;
c->ast[i]->codec->sample_rate = dv_audio_frequency[freq];
c->ast[i]->codec->channels = 2;
c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16;
c->ast[i]->start_time = 0;
}
c->ach = i;
......@@ -589,7 +589,7 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
sys = dv_frame_profile(frame);
if (sys) {
avctx = &c->vst->codec;
avctx = c->vst->codec;
av_set_pts_info(c->vst, 64, sys->frame_rate_base, sys->frame_rate);
avctx->time_base= (AVRational){sys->frame_rate_base, sys->frame_rate};
......@@ -628,10 +628,10 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st,
c->has_video = 0;
}
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
/* FIXME: we have to have more sensible approach than this one */
if (c->has_video)
av_log(&st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames);
av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames);
dv_inject_video(c, data, *frame);
c->has_video = 1;
......@@ -642,7 +642,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st,
reqasize = 4 * dv_audio_frame_size(c->sys, c->frames);
fsize = fifo_size(&c->audio_data, c->audio_data.rptr);
if (st->codec.codec_type == CODEC_TYPE_AUDIO || (c->has_video && fsize >= reqasize)) {
if (st->codec->codec_type == CODEC_TYPE_AUDIO || (c->has_video && fsize >= reqasize)) {
if (fsize + data_size >= reqasize && !c->has_audio) {
if (fsize >= reqasize) {
fifo_read(&c->audio_data, &pcm[0], reqasize, &c->audio_data.rptr);
......@@ -658,7 +658,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st,
/* FIXME: we have to have more sensible approach than this one */
if (fifo_size(&c->audio_data, c->audio_data.rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
av_log(&st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
fifo_write(&c->audio_data, (uint8_t *)data, data_size, &c->audio_data.wptr);
}
......@@ -682,7 +682,7 @@ DVMuxContext* dv_init_mux(AVFormatContext* s)
/* We have to sort out where audio and where video stream is */
for (i=0; i<s->nb_streams; i++) {
switch (s->streams[i]->codec.codec_type) {
switch (s->streams[i]->codec->codec_type) {
case CODEC_TYPE_VIDEO:
vst = s->streams[i];
break;
......@@ -695,13 +695,13 @@ DVMuxContext* dv_init_mux(AVFormatContext* s)
}
/* Some checks -- DV format is very picky about its incoming streams */
if (!vst || vst->codec.codec_id != CODEC_ID_DVVIDEO)
if (!vst || vst->codec->codec_id != CODEC_ID_DVVIDEO)
goto bail_out;
if (ast && (ast->codec.codec_id != CODEC_ID_PCM_S16LE ||
ast->codec.sample_rate != 48000 ||
ast->codec.channels != 2))
if (ast && (ast->codec->codec_id != CODEC_ID_PCM_S16LE ||
ast->codec->sample_rate != 48000 ||
ast->codec->channels != 2))
goto bail_out;
c->sys = dv_codec_profile(&vst->codec);
c->sys = dv_codec_profile(vst->codec);
if (!c->sys)
goto bail_out;
......@@ -711,7 +711,7 @@ DVMuxContext* dv_init_mux(AVFormatContext* s)
c->has_video = 0;
c->start_time = (time_t)s->timestamp;
c->aspect = 0; /* 4:3 is the default */
if ((int)(av_q2d(vst->codec.sample_aspect_ratio) * vst->codec.width / vst->codec.height * 10) == 17) /* 16:9 */
if ((int)(av_q2d(vst->codec->sample_aspect_ratio) * vst->codec->width / vst->codec->height * 10) == 17) /* 16:9 */
c->aspect = 0x07;
if (ast && fifo_init(&c->audio_data, 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0)
......@@ -751,9 +751,9 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s)
c->frames = 0;
c->abytes = 0;
c->vst->codec.codec_type = CODEC_TYPE_VIDEO;
c->vst->codec.codec_id = CODEC_ID_DVVIDEO;
c->vst->codec.bit_rate = 25000000;
c->vst->codec->codec_type = CODEC_TYPE_VIDEO;
c->vst->codec->codec_id = CODEC_ID_DVVIDEO;
c->vst->codec->bit_rate = 25000000;
c->vst->start_time = 0;
return c;
......@@ -790,7 +790,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
size = dv_extract_audio_info(c, buf);
for (i=0; i<c->ach; i++) {
c->audio_pkt[i].size = size;
c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec.bit_rate;
c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
}
dv_extract_audio(buf, c->audio_buf[0], c->audio_buf[1]);
c->abytes += size;
......@@ -813,7 +813,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
int64_t timestamp, int flags)
{
// FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
const DVprofile* sys = dv_codec_profile(&c->vst->codec);
const DVprofile* sys = dv_codec_profile(c->vst->codec);
int64_t offset;
int64_t size = url_fsize(&s->pb);
int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
......@@ -886,12 +886,12 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
RawDVContext *r = s->priv_data;
DVDemuxContext *c = r->dv_demux;
int64_t offset= dv_frame_offset(s, c, timestamp, flags);
const DVprofile* sys = dv_codec_profile(&c->vst->codec);
const DVprofile* sys = dv_codec_profile(c->vst->codec);
c->frames= offset / sys->frame_size;
if (c->ach)
c->abytes= av_rescale(c->frames,
c->ast[0]->codec.bit_rate * (int64_t)sys->frame_rate_base,
c->ast[0]->codec->bit_rate * (int64_t)sys->frame_rate_base,
8*sys->frame_rate);
dv_flush_audio_packets(c);
......
......@@ -188,9 +188,9 @@ static int ea_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
ea->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_EA_MJPEG;
st->codec.codec_tag = 0; /* no fourcc */
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_EA_MJPEG;
st->codec->codec_tag = 0; /* no fourcc */
#endif
/* initialize the audio decoder stream */
......@@ -198,15 +198,15 @@ static int ea_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, EA_SAMPLE_RATE);
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_ADPCM_EA;
st->codec.codec_tag = 0; /* no tag */
st->codec.channels = ea->num_channels;
st->codec.sample_rate = EA_SAMPLE_RATE;
st->codec.bits_per_sample = EA_BITS_PER_SAMPLE;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample / 4;
st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_EA;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = ea->num_channels;
st->codec->sample_rate = EA_SAMPLE_RATE;
st->codec->bits_per_sample = EA_BITS_PER_SAMPLE;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample / 4;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
ea->audio_stream_index = st->index;
ea->audio_frame_counter = 0;
......
......@@ -141,7 +141,7 @@ static int ffm_write_header(AVFormatContext *s)
bit_rate = 0;
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
bit_rate += st->codec.bit_rate;
bit_rate += st->codec->bit_rate;
}
put_be32(pb, bit_rate);
......@@ -154,7 +154,7 @@ static int ffm_write_header(AVFormatContext *s)
av_set_pts_info(st, 64, 1, 1000000);
st->priv_data = fst;
codec = &st->codec;
codec = st->codec;
/* generic info */
put_be32(pb, codec->codec_id);
put_byte(pb, codec->codec_type);
......@@ -247,10 +247,10 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
int size= pkt->size;
//XXX/FIXME use duration from pkt
if (st->codec.codec_type == CODEC_TYPE_AUDIO) {
duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0);
if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
duration = ((float)st->codec->frame_size / st->codec->sample_rate * 1000000.0);
} else {
duration = (1000000.0 * st->codec.time_base.num / (float)st->codec.time_base.den);
duration = (1000000.0 * st->codec->time_base.num / (float)st->codec->time_base.den);
}
pts = fst->pts;
......@@ -485,10 +485,10 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->priv_data = fst;
codec = &st->codec;
codec = st->codec;
/* generic info */
st->codec.codec_id = get_be32(pb);
st->codec.codec_type = get_byte(pb); /* codec_type */
st->codec->codec_id = get_be32(pb);
st->codec->codec_type = get_byte(pb); /* codec_type */
codec->bit_rate = get_be32(pb);
st->quality = get_be32(pb);
codec->flags = get_be32(pb);
......
......@@ -86,19 +86,19 @@ static int flic_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
flic->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_FLIC;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = LE_16(&header[0x08]);
st->codec.height = LE_16(&header[0x0A]);
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_FLIC;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = LE_16(&header[0x08]);
st->codec->height = LE_16(&header[0x0A]);
if (!st->codec.width || !st->codec.height)
if (!st->codec->width || !st->codec->height)
return AVERROR_INVALIDDATA;
/* send over the whole 128-byte FLIC header */
st->codec.extradata_size = FLIC_HEADER_SIZE;
st->codec.extradata = av_malloc(FLIC_HEADER_SIZE);
memcpy(st->codec.extradata, header, FLIC_HEADER_SIZE);
st->codec->extradata_size = FLIC_HEADER_SIZE;
st->codec->extradata = av_malloc(FLIC_HEADER_SIZE);
memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE);
av_set_pts_info(st, 33, 1, 90000);
......@@ -113,10 +113,10 @@ static int flic_read_header(AVFormatContext *s,
url_fseek(pb, 12, SEEK_SET);
/* send over abbreviated FLIC header chunk */
av_free(st->codec.extradata);
st->codec.extradata_size = 12;
st->codec.extradata = av_malloc(12);
memcpy(st->codec.extradata, header, 12);
av_free(st->codec->extradata);
st->codec->extradata_size = 12;
st->codec->extradata = av_malloc(12);
memcpy(st->codec->extradata, header, 12);
} else if (magic_number == FLIC_FILE_MAGIC_1) {
/*
......
......@@ -102,7 +102,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR_NOMEM;
av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */
st->codec.time_base= (AVRational){1,1000};
st->codec->time_base= (AVRational){1,1000};
}
// av_log(NULL, AV_LOG_DEBUG, "%d %X %d \n", is_audio, flags, st->discard);
if( (st->discard >= AVDISCARD_NONKEY && !((flags >> 4)==1 || is_audio))
......@@ -116,34 +116,34 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if(is_audio){
if(st->codec.sample_rate == 0){
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.channels = (flags&1)+1;
if(st->codec->sample_rate == 0){
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->channels = (flags&1)+1;
if((flags >> 4) == 5)
st->codec.sample_rate= 8000;
st->codec->sample_rate= 8000;
else
st->codec.sample_rate = (44100<<((flags>>2)&3))>>3;
st->codec->sample_rate = (44100<<((flags>>2)&3))>>3;
switch(flags >> 4){/* 0: uncompressed 1: ADPCM 2: mp3 5: Nellymoser 8kHz mono 6: Nellymoser*/
case 0: if (flags&2) st->codec.codec_id = CODEC_ID_PCM_S16BE;
else st->codec.codec_id = CODEC_ID_PCM_S8; break;
case 1: st->codec.codec_id = CODEC_ID_ADPCM_SWF; break;
case 2: st->codec.codec_id = CODEC_ID_MP3; break;
case 0: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16BE;
else st->codec->codec_id = CODEC_ID_PCM_S8; break;
case 1: st->codec->codec_id = CODEC_ID_ADPCM_SWF; break;
case 2: st->codec->codec_id = CODEC_ID_MP3; break;
// this is not listed at FLV but at SWF, strange...
case 3: if (flags&2) st->codec.codec_id = CODEC_ID_PCM_S16LE;
else st->codec.codec_id = CODEC_ID_PCM_S8; break;
case 3: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16LE;
else st->codec->codec_id = CODEC_ID_PCM_S8; break;
default:
av_log(s, AV_LOG_INFO, "Unsupported audio codec (%x)\n", flags >> 4);
st->codec.codec_tag= (flags >> 4);
st->codec->codec_tag= (flags >> 4);
}
st->codec.bits_per_sample = (flags & 2) ? 16 : 8;
st->codec->bits_per_sample = (flags & 2) ? 16 : 8;
}
}else{
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_type = CODEC_TYPE_VIDEO;
switch(flags & 0xF){
case 2: st->codec.codec_id = CODEC_ID_FLV1; break;
case 2: st->codec->codec_id = CODEC_ID_FLV1; break;
default:
av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flags & 0xf);
st->codec.codec_tag= flags & 0xF;
st->codec->codec_tag= flags & 0xF;
}
}
......
......@@ -97,7 +97,7 @@ static int flv_write_header(AVFormatContext *s)
put_be32(pb,0);
for(i=0; i<s->nb_streams; i++){
AVCodecContext *enc = &s->streams[i]->codec;
AVCodecContext *enc = s->streams[i]->codec;
av_set_pts_info(s->streams[i], 24, 1, 1000); /* 24 bit pts in ms */
if(enc->codec_tag == 5){
put_byte(pb,8); // message type
......@@ -134,7 +134,7 @@ static int flv_write_trailer(AVFormatContext *s)
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
ByteIOContext *pb = &s->pb;
AVCodecContext *enc = &s->streams[pkt->stream_index]->codec;
AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
FLVContext *flv = s->priv_data;
int size= pkt->size;
int flags;
......
......@@ -327,7 +327,7 @@ static int gif_write_header(AVFormatContext *s)
video_enc = NULL;
for(i=0;i<s->nb_streams;i++) {
enc = &s->streams[i]->codec;
enc = s->streams[i]->codec;
if (enc->codec_type != CODEC_TYPE_AUDIO)
video_enc = enc;
}
......@@ -388,7 +388,7 @@ static int gif_write_video(AVFormatContext *s,
static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVCodecContext *codec = &s->streams[pkt->stream_index]->codec;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
if (codec->codec_type == CODEC_TYPE_AUDIO)
return 0; /* just ignore audio */
else
......
......@@ -555,14 +555,14 @@ static int gif_read_header(AVFormatContext * s1,
if (!st)
return -1;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_RAWVIDEO;
st->codec.time_base.den = 5;
st->codec.time_base.num = 1;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->time_base.den = 5;
st->codec->time_base.num = 1;
/* XXX: check if screen size is always valid */
st->codec.width = s->screen_width;
st->codec.height = s->screen_height;
st->codec.pix_fmt = PIX_FMT_RGB24;
st->codec->width = s->screen_width;
st->codec->height = s->screen_height;
st->codec->pix_fmt = PIX_FMT_RGB24;
return 0;
}
......
......@@ -109,11 +109,11 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
desired_palette = -1;
if (st->codec.pix_fmt == PIX_FMT_YUV420P) {
if (st->codec->pix_fmt == PIX_FMT_YUV420P) {
desired_palette = VIDEO_PALETTE_YUV420P;
} else if (st->codec.pix_fmt == PIX_FMT_YUV422) {
} else if (st->codec->pix_fmt == PIX_FMT_YUV422) {
desired_palette = VIDEO_PALETTE_YUV422;
} else if (st->codec.pix_fmt == PIX_FMT_BGR24) {
} else if (st->codec->pix_fmt == PIX_FMT_BGR24) {
desired_palette = VIDEO_PALETTE_RGB24;
}
......@@ -245,15 +245,15 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
switch(s->frame_format) {
case VIDEO_PALETTE_YUV420P:
frame_size = (width * height * 3) / 2;
st->codec.pix_fmt = PIX_FMT_YUV420P;
st->codec->pix_fmt = PIX_FMT_YUV420P;
break;
case VIDEO_PALETTE_YUV422:
frame_size = width * height * 2;
st->codec.pix_fmt = PIX_FMT_YUV422;
st->codec->pix_fmt = PIX_FMT_YUV422;
break;
case VIDEO_PALETTE_RGB24:
frame_size = width * height * 3;
st->codec.pix_fmt = PIX_FMT_BGR24; /* NOTE: v4l uses BGR24, not RGB24 ! */
st->codec->pix_fmt = PIX_FMT_BGR24; /* NOTE: v4l uses BGR24, not RGB24 ! */
break;
default:
goto fail;
......@@ -261,12 +261,12 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->fd = video_fd;
s->frame_size = frame_size;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_RAWVIDEO;
st->codec.width = width;
st->codec.height = height;
st->codec.time_base.den = frame_rate;
st->codec.time_base.num = frame_rate_base;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->width = width;
st->codec->height = height;
st->codec->time_base.den = frame_rate;
st->codec->time_base.num = frame_rate_base;
return 0;
fail:
......
......@@ -156,20 +156,20 @@ static int idcin_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
idcin->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_IDCIN;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = width;
st->codec.height = height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_IDCIN;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = width;
st->codec->height = height;
/* load up the Huffman tables into extradata */
st->codec.extradata_size = HUFFMAN_TABLE_SIZE;
st->codec.extradata = av_malloc(HUFFMAN_TABLE_SIZE);
if (get_buffer(pb, st->codec.extradata, HUFFMAN_TABLE_SIZE) !=
st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
HUFFMAN_TABLE_SIZE)
return AVERROR_IO;
/* save a reference in order to transport the palette */
st->codec.palctrl = &idcin->palctrl;
st->codec->palctrl = &idcin->palctrl;
/* if sample rate is 0, assume no audio */
if (sample_rate) {
......@@ -179,17 +179,17 @@ static int idcin_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
idcin->audio_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = 1;
st->codec.channels = channels;
st->codec.sample_rate = sample_rate;
st->codec.bits_per_sample = bytes_per_sample * 8;
st->codec.bit_rate = sample_rate * bytes_per_sample * 8 * channels;
st->codec.block_align = bytes_per_sample * channels;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = 1;
st->codec->channels = channels;
st->codec->sample_rate = sample_rate;
st->codec->bits_per_sample = bytes_per_sample * 8;
st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
st->codec->block_align = bytes_per_sample * channels;
if (bytes_per_sample == 1)
st->codec.codec_id = CODEC_ID_PCM_U8;
st->codec->codec_id = CODEC_ID_PCM_U8;
else
st->codec.codec_id = CODEC_ID_PCM_S16LE;
st->codec->codec_id = CODEC_ID_PCM_S16LE;
if (sample_rate % 14 != 0) {
idcin->audio_chunk_size1 = (sample_rate / 14) *
......
......@@ -145,11 +145,11 @@ static int roq_read_header(AVFormatContext *s,
/* set the pts reference (1 pts = 1/90000) */
av_set_pts_info(st, 33, 1, 90000);
roq->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_ROQ;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = roq->width;
st->codec.height = roq->height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_ROQ;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = roq->width;
st->codec->height = roq->height;
if (roq->audio_channels) {
st = av_new_stream(s, 0);
......@@ -157,15 +157,15 @@ static int roq_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
roq->audio_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_ROQ_DPCM;
st->codec.codec_tag = 0; /* no tag */
st->codec.channels = roq->audio_channels;
st->codec.sample_rate = RoQ_AUDIO_SAMPLE_RATE;
st->codec.bits_per_sample = 16;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample;
st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ROQ_DPCM;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = roq->audio_channels;
st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE;
st->codec->bits_per_sample = 16;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
}
return 0;
......
......@@ -134,9 +134,9 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->is_pipe = 1;
if (!ap || !ap->time_base.num) {
st->codec.time_base= (AVRational){1,25};
st->codec->time_base= (AVRational){1,25};
} else {
st->codec.time_base= ap->time_base;
st->codec->time_base= ap->time_base;
}
if (!s->is_pipe) {
......@@ -166,11 +166,11 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
url_fseek(f, 0, SEEK_SET);
}
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_RAWVIDEO;
st->codec.width = s->width;
st->codec.height = s->height;
st->codec.pix_fmt = s->pix_fmt;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->width = s->width;
st->codec->height = s->height;
st->codec->pix_fmt = s->pix_fmt;
s->img_size = avpicture_get_size(s->pix_fmt, (s->width+15)&(~15), (s->height+15)&(~15));
return 0;
......@@ -232,7 +232,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
} else {
/* XXX: computing this pts is not necessary as it is done in
the generic code too */
pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec.time_base.num, s1->streams[0]->time_base.den, s1->streams[0]->codec.time_base.den) / s1->streams[0]->time_base.num;
pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec->time_base.num, s1->streams[0]->time_base.den, s1->streams[0]->codec->time_base.den) / s1->streams[0]->time_base.num;
s->img_count++;
s->img_number++;
return 0;
......@@ -276,7 +276,7 @@ static int img_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
return -1;
img->img_fmt = img_fmt;
img->pix_fmt = i;
st->codec.pix_fmt = img->pix_fmt;
st->codec->pix_fmt = img->pix_fmt;
return 0;
}
......@@ -306,8 +306,8 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
char filename[1024];
AVImageInfo info;
width = st->codec.width;
height = st->codec.height;
width = st->codec->width;
height = st->codec->height;
picture = (AVPicture *)pkt->data;
......@@ -323,7 +323,7 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
}
info.width = width;
info.height = height;
info.pix_fmt = st->codec.pix_fmt;
info.pix_fmt = st->codec->pix_fmt;
info.interleaved = 0; /* FIXME: there should be a way to set it right */
info.pict = *picture;
ret = av_write_image(pb, img->img_fmt, &info);
......
......@@ -193,8 +193,8 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
if(ap && ap->width && ap->height){
st->codec.width = ap->width;
st->codec.height= ap->height;
st->codec->width = ap->width;
st->codec->height= ap->height;
}
if (!s->is_pipe) {
......@@ -209,17 +209,17 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
if(ap->video_codec_id){
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = ap->video_codec_id;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = ap->video_codec_id;
}else if(ap->audio_codec_id){
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = ap->audio_codec_id;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = ap->audio_codec_id;
}else{
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = av_str2id(img_tags, s->path);
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = av_str2id(img_tags, s->path);
}
if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE)
st->codec.pix_fmt = ap->pix_fmt;
if(st->codec->codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE)
st->codec->pix_fmt = ap->pix_fmt;
return 0;
}
......@@ -231,7 +231,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
int i;
int size[3]={0}, ret[3]={0};
ByteIOContext f1[3], *f[3]= {&f1[0], &f1[1], &f1[2]};
AVCodecContext *codec= &s1->streams[0]->codec;
AVCodecContext *codec= s1->streams[0]->codec;
if (!s->is_pipe) {
/* loop over input */
......@@ -314,7 +314,7 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
VideoData *img = s->priv_data;
ByteIOContext pb1[3], *pb[3]= {&pb1[0], &pb1[1], &pb1[2]};
char filename[1024];
AVCodecContext *codec= &s->streams[ pkt->stream_index ]->codec;
AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
int i;
if (!img->is_pipe) {
......
......@@ -554,14 +554,14 @@ static int ipmovie_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
ipmovie->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_INTERPLAY_VIDEO;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = ipmovie->video_width;
st->codec.height = ipmovie->video_height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = ipmovie->video_width;
st->codec->height = ipmovie->video_height;
/* palette considerations */
st->codec.palctrl = &ipmovie->palette_control;
st->codec->palctrl = &ipmovie->palette_control;
if (ipmovie->audio_type) {
st = av_new_stream(s, 0);
......@@ -569,17 +569,17 @@ static int ipmovie_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
ipmovie->audio_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = ipmovie->audio_type;
st->codec.codec_tag = 0; /* no tag */
st->codec.channels = ipmovie->audio_channels;
st->codec.sample_rate = ipmovie->audio_sample_rate;
st->codec.bits_per_sample = ipmovie->audio_bits;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample;
if (st->codec.codec_id == CODEC_ID_INTERPLAY_DPCM)
st->codec.bit_rate /= 2;
st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = ipmovie->audio_type;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = ipmovie->audio_channels;
st->codec->sample_rate = ipmovie->audio_sample_rate;
st->codec->bits_per_sample = ipmovie->audio_bits;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
st->codec->bit_rate /= 2;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
}
return 0;
......
......@@ -2273,46 +2273,46 @@ matroska_read_header (AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */
st->codec.codec_id = codec_id;
st->codec->codec_id = codec_id;
if(extradata){
st->codec.extradata = extradata;
st->codec.extradata_size = extradata_size;
st->codec->extradata = extradata;
st->codec->extradata_size = extradata_size;
} else if(track->codec_priv && track->codec_priv_size > 0){
st->codec.extradata = av_malloc(track->codec_priv_size);
if(st->codec.extradata == NULL)
st->codec->extradata = av_malloc(track->codec_priv_size);
if(st->codec->extradata == NULL)
return AVERROR_NOMEM;
st->codec.extradata_size = track->codec_priv_size;
memcpy(st->codec.extradata, track->codec_priv,
st->codec->extradata_size = track->codec_priv_size;
memcpy(st->codec->extradata, track->codec_priv,
track->codec_priv_size);
}
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
MatroskaVideoTrack *videotrack = (MatroskaVideoTrack *)track;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_tag = videotrack->fourcc;
st->codec.width = videotrack->pixel_width;
st->codec.height = videotrack->pixel_height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_tag = videotrack->fourcc;
st->codec->width = videotrack->pixel_width;
st->codec->height = videotrack->pixel_height;
if (videotrack->display_width == 0)
st->codec.sample_aspect_ratio.num =
st->codec->sample_aspect_ratio.num =
videotrack->pixel_width;
else
st->codec.sample_aspect_ratio.num =
st->codec->sample_aspect_ratio.num =
videotrack->display_width;
if (videotrack->display_height == 0)
st->codec.sample_aspect_ratio.num =
st->codec->sample_aspect_ratio.num =
videotrack->pixel_height;
else
st->codec.sample_aspect_ratio.num =
st->codec->sample_aspect_ratio.num =
videotrack->display_height;
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)track;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.sample_rate = audiotrack->samplerate;
st->codec.channels = audiotrack->channels;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->sample_rate = audiotrack->samplerate;
st->codec->channels = audiotrack->channels;
}
/* What do we do with private data? E.g. for Vorbis. */
......@@ -2700,7 +2700,7 @@ matroska_read_close (AVFormatContext *s)
}
for (n = 0; n < s->nb_streams; n++) {
av_free(s->streams[n]->codec.extradata);
av_free(s->streams[n]->codec->extradata);
}
memset(matroska, 0, sizeof(MatroskaDemuxContext));
......
......@@ -61,9 +61,9 @@ static int mmf_write_header(AVFormatContext *s)
offset_t pos;
int rate;
rate = mmf_rate_code(s->streams[0]->codec.sample_rate);
rate = mmf_rate_code(s->streams[0]->codec->sample_rate);
if(rate < 0) {
av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec.sample_rate);
av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate);
return -1;
}
......@@ -96,7 +96,7 @@ static int mmf_write_header(AVFormatContext *s)
mmf->awapos = start_tag(pb, "Awa\x01");
av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec.sample_rate);
av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
put_flush_packet(pb);
......@@ -144,7 +144,7 @@ static int mmf_write_trailer(AVFormatContext *s)
/* "play wav" */
put_byte(pb, 0); /* start time */
put_byte(pb, 1); /* (channel << 6) | wavenum */
gatetime = size * 500 / s->streams[0]->codec.sample_rate;
gatetime = size * 500 / s->streams[0]->codec->sample_rate;
put_varlength(pb, gatetime); /* duration */
/* "nop" */
......@@ -239,14 +239,14 @@ static int mmf_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_ADPCM_YAMAHA;
st->codec.sample_rate = rate;
st->codec.channels = 1;
st->codec.bits_per_sample = 4;
st->codec.bit_rate = st->codec.sample_rate * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_YAMAHA;
st->codec->sample_rate = rate;
st->codec->channels = 1;
st->codec->bits_per_sample = 4;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_sample;
av_set_pts_info(st, 64, 1, st->codec.sample_rate);
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
return 0;
}
......
This diff is collapsed.
......@@ -1256,11 +1256,11 @@ int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
{
int AudioRate = s->streams[1]->codec.sample_rate;
int FrameRate = ((s->streams[0]->codec.time_base.den) * (0x10000))/ (s->streams[0]->codec.time_base.num);
int AudioRate = s->streams[1]->codec->sample_rate;
int FrameRate = ((s->streams[0]->codec->time_base.den) * (0x10000))/ (s->streams[0]->codec->time_base.num);
//printf("audiorate = %d\n",AudioRate);
//printf("framerate = %d / %d = 0x%x\n",s->streams[0]->codec.time_base.den,s->streams[0]->codec.time_base.num,FrameRate);
//printf("framerate = %d / %d = 0x%x\n",s->streams[0]->codec->time_base.den,s->streams[0]->codec->time_base.num,FrameRate);
put_be32(pb, 0x94 ); /* size */
put_tag(pb, "uuid");
......@@ -1302,8 +1302,8 @@ static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
put_be32(pb, 0xc0 );
put_be32(pb, FrameRate); // was 0xefc29
put_be32(pb, FrameRate ); // was 0xefc29
put_be16(pb, s->streams[0]->codec.width);
put_be16(pb, s->streams[0]->codec.height);
put_be16(pb, s->streams[0]->codec->width);
put_be16(pb, s->streams[0]->codec->height);
put_be32(pb, 0x010001 );
}
......@@ -1314,7 +1314,7 @@ static int mov_write_header(AVFormatContext *s)
int i;
for(i=0; i<s->nb_streams; i++){
AVCodecContext *c= &s->streams[i]->codec;
AVCodecContext *c= s->streams[i]->codec;
if (c->codec_type == CODEC_TYPE_VIDEO){
if (!codec_get_tag(codec_movvideo_tags, c->codec_id)){
......@@ -1367,7 +1367,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
{
MOVContext *mov = s->priv_data;
ByteIOContext *pb = &s->pb;
AVCodecContext *enc = &s->streams[pkt->stream_index]->codec;
AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
MOVTrack* trk = &mov->tracks[pkt->stream_index];
int cl, id;
unsigned int samplesInChunk = 0;
......
......@@ -251,8 +251,8 @@ static int mp3_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_MP3;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP3;
st->need_parsing = 1;
/* try to get the TAG */
......
......@@ -360,26 +360,26 @@ static int mpeg_mux_init(AVFormatContext *ctx)
av_set_pts_info(st, 64, 1, 90000);
switch(st->codec.codec_type) {
switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
if (st->codec.codec_id == CODEC_ID_AC3) {
if (st->codec->codec_id == CODEC_ID_AC3) {
stream->id = ac3_id++;
} else if (st->codec.codec_id == CODEC_ID_DTS) {
} else if (st->codec->codec_id == CODEC_ID_DTS) {
stream->id = dts_id++;
} else if (st->codec.codec_id == CODEC_ID_PCM_S16BE) {
} else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
stream->id = lpcm_id++;
for(j = 0; j < 4; j++) {
if (lpcm_freq_tab[j] == st->codec.sample_rate)
if (lpcm_freq_tab[j] == st->codec->sample_rate)
break;
}
if (j == 4)
goto fail;
if (st->codec.channels > 8)
if (st->codec->channels > 8)
return -1;
stream->lpcm_header[0] = 0x0c;
stream->lpcm_header[1] = (st->codec.channels - 1) | (j << 4);
stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4);
stream->lpcm_header[2] = 0x80;
stream->lpcm_align = st->codec.channels * 2;
stream->lpcm_align = st->codec->channels * 2;
} else {
stream->id = mpa_id++;
}
......@@ -391,8 +391,8 @@ static int mpeg_mux_init(AVFormatContext *ctx)
break;
case CODEC_TYPE_VIDEO:
stream->id = mpv_id++;
if (st->codec.rc_buffer_size)
stream->max_buffer_size = 6*1024 + st->codec.rc_buffer_size/8;
if (st->codec->rc_buffer_size)
stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8;
else
stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default
#if 0
......@@ -422,10 +422,10 @@ static int mpeg_mux_init(AVFormatContext *ctx)
st = ctx->streams[i];
stream = (StreamInfo*) st->priv_data;
if(st->codec.rc_max_rate || stream->id==VIDEO_ID)
codec_rate= st->codec.rc_max_rate;
if(st->codec->rc_max_rate || stream->id==VIDEO_ID)
codec_rate= st->codec->rc_max_rate;
else
codec_rate= st->codec.bit_rate;
codec_rate= st->codec->bit_rate;
if(!codec_rate)
codec_rate= (1<<21)*8*50/ctx->nb_streams;
......@@ -1073,7 +1073,7 @@ retry:
/* for subtitle, a single PES packet must be generated,
so we flush after every single subtitle packet */
if(s->packet_size > avail_data && !flush
&& st->codec.codec_type != CODEC_TYPE_SUBTITLE)
&& st->codec->codec_type != CODEC_TYPE_SUBTITLE)
return 0;
if(avail_data==0)
continue;
......@@ -1183,7 +1183,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
int64_t pts, dts;
PacketDesc *pkt_desc;
const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE);
const int is_iframe = st->codec.codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY);
const int is_iframe = st->codec->codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY);
pts= pkt->pts;
dts= pkt->dts;
......@@ -1634,8 +1634,8 @@ static int mpegps_read_packet(AVFormatContext *s,
st = av_new_stream(s, startcode);
if (!st)
goto skip;
st->codec.codec_type = type;
st->codec.codec_id = codec_id;
st->codec->codec_type = type;
st->codec->codec_id = codec_id;
if (codec_id != CODEC_ID_PCM_S16BE)
st->need_parsing = 1;
found:
......@@ -1653,9 +1653,9 @@ static int mpegps_read_packet(AVFormatContext *s,
get_byte(&s->pb); /* dynamic range control (0x80 = off) */
len -= 3;
freq = (b1 >> 4) & 3;
st->codec.sample_rate = lpcm_freq_tab[freq];
st->codec.channels = 1 + (b1 & 7);
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2;
st->codec->sample_rate = lpcm_freq_tab[freq];
st->codec->channels = 1 + (b1 & 7);
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2;
}
av_new_packet(pkt, len);
get_buffer(&s->pb, pkt->data, pkt->size);
......
......@@ -493,7 +493,7 @@ static void pmt_cb(void *opaque, const uint8_t *section, int section_len)
}
if (stream_type == STREAM_TYPE_SUBTITLE_DVB) {
st->codec.sub_id = (anc_page << 16) | comp_page;
st->codec->sub_id = (anc_page << 16) | comp_page;
}
}
}
......@@ -921,8 +921,8 @@ static AVStream* new_pes_av_stream(PESContext *pes, uint32_t code)
if (st) {
av_set_pts_info(st, 33, 1, 90000);
st->priv_data = pes;
st->codec.codec_type = codec_type;
st->codec.codec_id = codec_id;
st->codec->codec_type = codec_type;
st->codec->codec_id = codec_id;
st->need_parsing = 1;
pes->st = st;
}
......@@ -1253,8 +1253,8 @@ static int mpegts_read_header(AVFormatContext *s,
if (!st)
goto fail;
av_set_pts_info(st, 60, 1, 27000000);
st->codec.codec_type = CODEC_TYPE_DATA;
st->codec.codec_id = CODEC_ID_MPEG2TS;
st->codec->codec_type = CODEC_TYPE_DATA;
st->codec->codec_id = CODEC_ID_MPEG2TS;
/* we iterate until we find two PCRs to estimate the bitrate */
pcr_pid = -1;
......@@ -1283,7 +1283,7 @@ static int mpegts_read_header(AVFormatContext *s,
ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0];
s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
st->codec.bit_rate = s->bit_rate;
st->codec->bit_rate = s->bit_rate;
st->start_time = ts->cur_pcr;
#if 0
printf("start=%0.3f pcr=%0.3f incr=%d\n",
......
......@@ -262,7 +262,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
for(i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
MpegTSWriteStream *ts_st = st->priv_data;
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
stream_type = STREAM_TYPE_VIDEO_MPEG2;
......@@ -293,7 +293,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
q += 2; /* patched after */
/* write optional descriptors here */
switch(st->codec.codec_type) {
switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
if (strlen(st->language) == 3) {
*q++ = 0x0a; /* ISO 639 language descriptor */
......@@ -452,10 +452,10 @@ static int mpegts_write_header(AVFormatContext *s)
ts_st->pid = DEFAULT_START_PID + i;
ts_st->payload_pts = AV_NOPTS_VALUE;
/* update PCR pid by using the first video stream */
if (st->codec.codec_type == CODEC_TYPE_VIDEO &&
if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
service->pcr_pid == 0x1fff)
service->pcr_pid = ts_st->pid;
total_bit_rate += st->codec.bit_rate;
total_bit_rate += st->codec->bit_rate;
}
/* if no video stream, use the first stream as PCR */
......@@ -570,15 +570,15 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
*q++ = 0x00;
*q++ = 0x01;
private_code = 0;
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
*q++ = 0xe0;
} else if (st->codec.codec_type == CODEC_TYPE_AUDIO &&
(st->codec.codec_id == CODEC_ID_MP2 ||
st->codec.codec_id == CODEC_ID_MP3)) {
} else if (st->codec->codec_type == CODEC_TYPE_AUDIO &&
(st->codec->codec_id == CODEC_ID_MP2 ||
st->codec->codec_id == CODEC_ID_MP3)) {
*q++ = 0xc0;
} else {
*q++ = 0xbd;
if (st->codec.codec_type == CODEC_TYPE_SUBTITLE) {
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
private_code = 0x20;
}
}
......@@ -593,7 +593,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
*q++ = len;
val = 0x80;
/* data alignment indicator is required for subtitle data */
if (st->codec.codec_type == CODEC_TYPE_SUBTITLE)
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE)
val |= 0x04;
*q++ = val;
if (pts != AV_NOPTS_VALUE) {
......@@ -660,7 +660,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
MpegTSWriteStream *ts_st = st->priv_data;
int len, max_payload_size;
if (st->codec.codec_type == CODEC_TYPE_SUBTITLE) {
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
/* for subtitle, a single PES packet must be generated */
mpegts_write_pes(s, st, buf, size, pkt->pts);
return 0;
......
......@@ -439,12 +439,12 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
if (!nst)
goto fail;
st->priv_data = nst;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_tag = vtag;
st->codec.codec_id = codec_get_id(nsv_codec_video_tags, vtag);
st->codec.width = vwidth;
st->codec.height = vheight;
st->codec.bits_per_sample = 24; /* depth XXX */
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_tag = vtag;
st->codec->codec_id = codec_get_id(nsv_codec_video_tags, vtag);
st->codec->width = vwidth;
st->codec->height = vheight;
st->codec->bits_per_sample = 24; /* depth XXX */
av_set_pts_info(st, 64, framerate.den, framerate.num);
st->start_time = 0;
......@@ -460,17 +460,17 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
if (!nst)
goto fail;
st->priv_data = nst;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = atag;
st->codec.codec_id = codec_get_id(nsv_codec_audio_tags, atag);
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = atag;
st->codec->codec_id = codec_get_id(nsv_codec_audio_tags, atag);
st->start_time = 0;
// st->duration = nsv->duration; //FIXME
st->need_parsing = 1; /* for PCM we will read a chunk later and put correct info */
/* XXX:FIXME */
//st->codec.channels = 2; //XXX:channels;
//st->codec.sample_rate = 1000;
//av_set_pts_info(st, 64, 1, st->codec.sample_rate);
//st->codec->channels = 2; //XXX:channels;
//st->codec->sample_rate = 1000;
//av_set_pts_info(st, 64, 1, st->codec->sample_rate);
#endif
}
......@@ -606,7 +606,7 @@ null_chunk_retry:
pkt = &nsv->ahead[NSV_ST_AUDIO];
/* read raw audio specific header on the first audio chunk... */
/* on ALL audio chunks ?? seems so! */
if (asize && st[NSV_ST_AUDIO]->codec.codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
if (asize && st[NSV_ST_AUDIO]->codec->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
uint8_t bps;
uint8_t channels;
uint16_t samplerate;
......@@ -622,13 +622,13 @@ null_chunk_retry:
}
bps /= channels; // ???
if (bps == 8)
st[NSV_ST_AUDIO]->codec.codec_id = CODEC_ID_PCM_U8;
st[NSV_ST_AUDIO]->codec->codec_id = CODEC_ID_PCM_U8;
samplerate /= 4;/* UGH ??? XXX */
channels = 1;
st[NSV_ST_AUDIO]->codec.channels = channels;
st[NSV_ST_AUDIO]->codec.sample_rate = samplerate;
st[NSV_ST_AUDIO]->codec->channels = channels;
st[NSV_ST_AUDIO]->codec->sample_rate = samplerate;
av_set_pts_info(st[NSV_ST_AUDIO], 64, 1,
st[NSV_ST_AUDIO]->codec.sample_rate);
st[NSV_ST_AUDIO]->codec->sample_rate);
PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %ld\n", bps, channels, samplerate));
}
}
......@@ -704,8 +704,8 @@ static int nsv_read_close(AVFormatContext *s)
av_free(ast->index_entries);
av_free(ast);
}
av_free(st->codec.extradata);
av_free(st->codec.palctrl);
av_free(st->codec->extradata);
av_free(st->codec->palctrl);
}
#endif
......
......@@ -155,7 +155,7 @@ static void build_frame_code(AVFormatContext *s){
for(stream_id= 0; stream_id<s->nb_streams; stream_id++){
int start2= start + (end-start)*stream_id / s->nb_streams;
int end2 = start + (end-start)*(stream_id+1) / s->nb_streams;
AVCodecContext *codec = &s->streams[stream_id]->codec;
AVCodecContext *codec = s->streams[stream_id]->codec;
int is_audio= codec->codec_type == CODEC_TYPE_AUDIO;
int intra_only= /*codec->intra_only || */is_audio;
int pred_count;
......@@ -579,7 +579,7 @@ static int nut_write_header(AVFormatContext *s)
{
int nom, denom, ssize;
codec = &s->streams[i]->codec;
codec = s->streams[i]->codec;
put_be64(bc, STREAM_STARTCODE);
put_packetheader(nut, bc, 120 + codec->extradata_size, 1);
......@@ -674,7 +674,7 @@ static int nut_write_header(AVFormatContext *s)
put_str(bc, s->copyright);
}
/* encoder */
if(!(s->streams[0]->codec.flags & CODEC_FLAG_BITEXACT)){
if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)){
put_v(bc, 13); /* type */
put_str(bc, LIBAVFORMAT_IDENT);
}
......@@ -707,7 +707,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
int size= pkt->size;
int stream_index= pkt->stream_index;
enc = &s->streams[stream_index]->codec;
enc = s->streams[stream_index]->codec;
key_frame = !!(pkt->flags & PKT_FLAG_KEY);
frame_type=0;
......@@ -949,27 +949,27 @@ static int decode_stream_header(NUTContext *nut){
class = get_v(bc);
tmp = get_vb(bc);
st->codec.codec_tag= tmp;
st->codec->codec_tag= tmp;
switch(class)
{
case 0:
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = codec_get_bmp_id(tmp);
if (st->codec.codec_id == CODEC_ID_NONE)
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = codec_get_bmp_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 1:
case 32: //compatibility
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = codec_get_wav_id(tmp);
if (st->codec.codec_id == CODEC_ID_NONE)
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = codec_get_wav_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 2:
// st->codec.codec_type = CODEC_TYPE_TEXT;
// st->codec->codec_type = CODEC_TYPE_TEXT;
// break;
case 3:
st->codec.codec_type = CODEC_TYPE_DATA;
st->codec->codec_type = CODEC_TYPE_DATA;
break;
default:
av_log(s, AV_LOG_ERROR, "Unknown stream class (%d)\n", class);
......@@ -980,33 +980,33 @@ static int decode_stream_header(NUTContext *nut){
nom = get_v(bc);
denom = get_v(bc);
nut->stream[stream_id].msb_timestamp_shift = get_v(bc);
st->codec.has_b_frames=
st->codec->has_b_frames=
nut->stream[stream_id].decode_delay= get_v(bc);
get_byte(bc); /* flags */
/* codec specific data headers */
while(get_v(bc) != 0){
st->codec.extradata_size= get_v(bc);
if((unsigned)st->codec.extradata_size > (1<<30))
st->codec->extradata_size= get_v(bc);
if((unsigned)st->codec->extradata_size > (1<<30))
return -1;
st->codec.extradata= av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(bc, st->codec.extradata, st->codec.extradata_size);
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
// url_fskip(bc, get_v(bc));
}
if (st->codec.codec_type == CODEC_TYPE_VIDEO) /* VIDEO */
if (st->codec->codec_type == CODEC_TYPE_VIDEO) /* VIDEO */
{
st->codec.width = get_v(bc);
st->codec.height = get_v(bc);
st->codec.sample_aspect_ratio.num= get_v(bc);
st->codec.sample_aspect_ratio.den= get_v(bc);
st->codec->width = get_v(bc);
st->codec->height = get_v(bc);
st->codec->sample_aspect_ratio.num= get_v(bc);
st->codec->sample_aspect_ratio.den= get_v(bc);
get_v(bc); /* csp type */
}
if (st->codec.codec_type == CODEC_TYPE_AUDIO) /* AUDIO */
if (st->codec->codec_type == CODEC_TYPE_AUDIO) /* AUDIO */
{
st->codec.sample_rate = get_v(bc);
st->codec->sample_rate = get_v(bc);
get_v(bc); // samplerate_den
st->codec.channels = get_v(bc);
st->codec->channels = get_v(bc);
}
if(check_checksum(bc)){
av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", stream_id);
......@@ -1407,7 +1407,7 @@ static int nut_read_close(AVFormatContext *s)
int i;
for(i=0;i<s->nb_streams;i++) {
av_freep(&s->streams[i]->codec.extradata);
av_freep(&s->streams[i]->codec->extradata);
}
av_freep(&nut->stream);
......
......@@ -39,7 +39,7 @@ static int ogg_write_header(AVFormatContext *avfcontext)
ogg_stream_init(&context->os, 31415);
for(n = 0 ; n < avfcontext->nb_streams ; n++) {
AVCodecContext *codec = &avfcontext->streams[n]->codec;
AVCodecContext *codec = avfcontext->streams[n]->codec;
uint8_t *p= codec->extradata;
av_set_pts_info(avfcontext->streams[n], 60, 1, AV_TIME_BASE);
......@@ -65,7 +65,7 @@ static int ogg_write_header(AVFormatContext *avfcontext)
static int ogg_write_packet(AVFormatContext *avfcontext, AVPacket *pkt)
{
OggContext *context = avfcontext->priv_data ;
AVCodecContext *avctx= &avfcontext->streams[pkt->stream_index]->codec;
AVCodecContext *avctx= avfcontext->streams[pkt->stream_index]->codec;
ogg_packet *op= &context->op;
ogg_page og ;
int64_t pts;
......
......@@ -430,7 +430,7 @@ ogg_gptopts (AVFormatContext * s, int i, uint64_t gp)
ogg_t *ogg = s->priv_data;
ogg_stream_t *os = ogg->streams + i;
AVStream *st = s->streams[i];
AVCodecContext *codec = &st->codec;
AVCodecContext *codec = st->codec;
uint64_t pts = AV_NOPTS_VALUE;
if(os->codec->gptopts){
......@@ -537,7 +537,7 @@ ogg_read_close (AVFormatContext * s)
for (i = 0; i < ogg->nstreams; i++){
av_free (ogg->streams[i].buf);
av_free (ogg->streams[i].private);
av_freep (&s->streams[i]->codec.extradata);
av_freep (&s->streams[i]->codec->extradata);
}
av_free (ogg->streams);
return 0;
......
......@@ -52,17 +52,17 @@ flac_header (AVFormatContext * s, int idx)
skip_bits(&gb, 16*2+24*2);
st->codec.sample_rate = get_bits_long(&gb, 20);
st->codec.channels = get_bits(&gb, 3) + 1;
st->codec->sample_rate = get_bits_long(&gb, 20);
st->codec->channels = get_bits(&gb, 3) + 1;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_FLAC;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_FLAC;
st->codec.extradata =
st->codec->extradata =
av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (st->codec.extradata, os->buf + os->pstart + 5 + 4 + 4 + 4,
memcpy (st->codec->extradata, os->buf + os->pstart + 5 + 4 + 4 + 4,
FLAC_STREAMINFO_SIZE);
st->codec.extradata_size = FLAC_STREAMINFO_SIZE;
st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
} else if (mdt == 4) {
vorbis_comment (s, os->buf + os->pstart + 4, os->psize - 4);
}
......
......@@ -40,7 +40,7 @@ theora_header (AVFormatContext * s, int idx)
ogg_stream_t *os = ogg->streams + idx;
AVStream *st = s->streams[idx];
theora_params_t *thp = os->private;
int cds = st->codec.extradata_size + os->psize + 2;
int cds = st->codec->extradata_size + os->psize + 2;
uint8_t *cdp;
if(!(os->buf[os->pstart] & 0x80))
......@@ -62,33 +62,33 @@ theora_header (AVFormatContext * s, int idx)
return -1;
skip_bits(&gb, 8); /* revision */
st->codec.width = get_bits(&gb, 16) << 4;
st->codec.height = get_bits(&gb, 16) << 4;
st->codec->width = get_bits(&gb, 16) << 4;
st->codec->height = get_bits(&gb, 16) << 4;
skip_bits(&gb, 64);
st->codec.time_base.den = get_bits(&gb, 32);
st->codec.time_base.num = get_bits(&gb, 32);
st->codec->time_base.den = get_bits(&gb, 32);
st->codec->time_base.num = get_bits(&gb, 32);
st->codec.sample_aspect_ratio.num = get_bits(&gb, 24);
st->codec.sample_aspect_ratio.den = get_bits(&gb, 24);
st->codec->sample_aspect_ratio.num = get_bits(&gb, 24);
st->codec->sample_aspect_ratio.den = get_bits(&gb, 24);
skip_bits(&gb, 38);
thp->gpshift = get_bits(&gb, 5);
thp->gpmask = (1 << thp->gpshift) - 1;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_THEORA;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_THEORA;
} else if (os->buf[os->pstart] == 0x83) {
vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8);
}
st->codec.extradata = av_realloc (st->codec.extradata, cds);
cdp = st->codec.extradata + st->codec.extradata_size;
st->codec->extradata = av_realloc (st->codec->extradata, cds);
cdp = st->codec->extradata + st->codec->extradata_size;
*cdp++ = os->psize >> 8;
*cdp++ = os->psize & 0xff;
memcpy (cdp, os->buf + os->pstart, os->psize);
st->codec.extradata_size = cds;
st->codec->extradata_size = cds;
return 1;
}
......@@ -103,8 +103,8 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp)
uint64_t iframe = gp >> thp->gpshift;
uint64_t pframe = gp & thp->gpmask;
return (iframe + pframe) * AV_TIME_BASE * st->codec.time_base.num /
st->codec.time_base.den;
return (iframe + pframe) * AV_TIME_BASE * st->codec->time_base.num /
st->codec->time_base.den;
}
ogg_codec_t theora_codec = {
......
......@@ -178,19 +178,19 @@ vorbis_header (AVFormatContext * s, int idx)
memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);
if (os->buf[os->pstart] == 1) {
uint8_t *p = os->buf + os->pstart + 11; //skip up to the audio channels
st->codec.channels = *p++;
st->codec.sample_rate = le2me_32 (unaligned32 (p));
st->codec->channels = *p++;
st->codec->sample_rate = le2me_32 (unaligned32 (p));
p += 8; //skip maximum and and nominal bitrate
st->codec.bit_rate = le2me_32 (unaligned32 (p)); //Minimum bitrate
st->codec->bit_rate = le2me_32 (unaligned32 (p)); //Minimum bitrate
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_VORBIS;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_VORBIS;
} else if (os->buf[os->pstart] == 3) {
vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8);
} else {
st->codec.extradata_size =
fixup_vorbis_headers(s, priv, &st->codec.extradata);
st->codec->extradata_size =
fixup_vorbis_headers(s, priv, &st->codec->extradata);
}
return os->seq < 3;
......
......@@ -182,11 +182,11 @@ static int str_read_header(AVFormatContext *s,
str->channels[channel].video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_MDEC;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = str->channels[channel].width;
st->codec.height = str->channels[channel].height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MDEC;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = str->channels[channel].width;
st->codec->height = str->channels[channel].height;
}
break;
......@@ -212,13 +212,13 @@ static int str_read_header(AVFormatContext *s,
str->channels[channel].audio_stream_index = st->index;
fmt = sector[0x13];
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_ADPCM_XA;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.channels = (fmt&1)?2:1;
st->codec.sample_rate = (fmt&4)?18900:37800;
// st->codec.bit_rate = 0; //FIXME;
st->codec.block_align = 128;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_XA;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->channels = (fmt&1)?2:1;
st->codec->sample_rate = (fmt&4)?18900:37800;
// st->codec->bit_rate = 0; //FIXME;
st->codec->block_align = 128;
}
break;
......
......@@ -50,25 +50,25 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (ap) {
id = s->iformat->value;
if (id == CODEC_ID_RAWVIDEO) {
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_type = CODEC_TYPE_VIDEO;
} else {
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_type = CODEC_TYPE_AUDIO;
}
st->codec.codec_id = id;
st->codec->codec_id = id;
switch(st->codec.codec_type) {
switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
st->codec.sample_rate = ap->sample_rate;
st->codec.channels = ap->channels;
av_set_pts_info(st, 64, 1, st->codec.sample_rate);
st->codec->sample_rate = ap->sample_rate;
st->codec->channels = ap->channels;
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
break;
case CODEC_TYPE_VIDEO:
av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
st->codec.width = ap->width;
st->codec.height = ap->height;
st->codec.pix_fmt = ap->pix_fmt;
if(st->codec.pix_fmt == PIX_FMT_NONE)
st->codec.pix_fmt= PIX_FMT_YUV420P;
st->codec->width = ap->width;
st->codec->height = ap->height;
st->codec->pix_fmt = ap->pix_fmt;
if(st->codec->pix_fmt == PIX_FMT_NONE)
st->codec->pix_fmt= PIX_FMT_YUV420P;
break;
default:
return -1;
......@@ -133,24 +133,24 @@ int pcm_read_seek(AVFormatContext *s,
int64_t pos;
st = s->streams[0];
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:
case CODEC_ID_PCM_U16BE:
block_align = 2 * st->codec.channels;
byte_rate = block_align * st->codec.sample_rate;
block_align = 2 * st->codec->channels;
byte_rate = block_align * st->codec->sample_rate;
break;
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_MULAW:
case CODEC_ID_PCM_ALAW:
block_align = st->codec.channels;
byte_rate = block_align * st->codec.sample_rate;
block_align = st->codec->channels;
byte_rate = block_align * st->codec->sample_rate;
break;
default:
block_align = st->codec.block_align;
byte_rate = st->codec.bit_rate / 8;
block_align = st->codec->block_align;
byte_rate = st->codec->bit_rate / 8;
break;
}
......@@ -180,8 +180,8 @@ static int ac3_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_AC3;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_AC3;
st->need_parsing = 1;
/* the parameters will be extracted from the compressed bitstream */
return 0;
......@@ -195,8 +195,8 @@ static int shorten_read_header(AVFormatContext *s,
st = av_new_stream(s, 0);
if (!st)
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_SHORTEN;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_SHORTEN;
st->need_parsing = 1;
/* the parameters will be extracted from the compressed bitstream */
return 0;
......@@ -212,8 +212,8 @@ static int dts_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_DTS;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_DTS;
st->need_parsing = 1;
/* the parameters will be extracted from the compressed bitstream */
return 0;
......@@ -229,17 +229,17 @@ static int video_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = s->iformat->value;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = s->iformat->value;
st->need_parsing = 1;
/* for mjpeg, specify frame rate */
/* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
if (ap && ap->time_base.num) {
av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
} else if ( st->codec.codec_id == CODEC_ID_MJPEG ||
st->codec.codec_id == CODEC_ID_MPEG4 ||
st->codec.codec_id == CODEC_ID_H264) {
} else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
st->codec->codec_id == CODEC_ID_MPEG4 ||
st->codec->codec_id == CODEC_ID_H264) {
av_set_pts_info(st, 64, 1, 25);
}
......@@ -609,10 +609,10 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
int packet_size, ret, width, height;
AVStream *st = s->streams[0];
width = st->codec.width;
height = st->codec.height;
width = st->codec->width;
height = st->codec->height;
packet_size = avpicture_get_size(st->codec.pix_fmt, width, height);
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
if (packet_size < 0)
return -1;
......
......@@ -298,7 +298,7 @@ static int rm_write_header(AVFormatContext *s)
for(n=0;n<s->nb_streams;n++) {
s->streams[n]->id = n;
codec = &s->streams[n]->codec;
codec = s->streams[n]->codec;
stream = &rm->streams[n];
memset(stream, 0, sizeof(StreamInfo));
stream->num = n;
......@@ -399,7 +399,7 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int
static int rm_write_packet(AVFormatContext *s, AVPacket *pkt)
{
if (s->streams[pkt->stream_index]->codec.codec_type ==
if (s->streams[pkt->stream_index]->codec->codec_type ==
CODEC_TYPE_AUDIO)
return rm_write_audio(s, pkt->data, pkt->size, pkt->flags);
else
......@@ -495,10 +495,10 @@ static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
get_str8(pb, s->comment, sizeof(s->comment));
get_byte(pb);
get_str8(pb, buf, sizeof(buf));
st->codec.sample_rate = 8000;
st->codec.channels = 1;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_RA_144;
st->codec->sample_rate = 8000;
st->codec->channels = 1;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_RA_144;
} else {
int flavor, sub_packet_h, coded_framesize;
/* old version (4) */
......@@ -512,30 +512,30 @@ static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
get_be32(pb); /* ??? */
get_be32(pb); /* ??? */
sub_packet_h= get_be16(pb); /* 1 */
st->codec.block_align= get_be16(pb); /* frame size */
st->codec->block_align= get_be16(pb); /* frame size */
get_be16(pb); /* sub packet size */
get_be16(pb); /* ??? */
st->codec.sample_rate = get_be16(pb);
st->codec->sample_rate = get_be16(pb);
get_be32(pb);
st->codec.channels = get_be16(pb);
st->codec->channels = get_be16(pb);
get_str8(pb, buf, sizeof(buf)); /* desc */
get_str8(pb, buf, sizeof(buf)); /* desc */
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_type = CODEC_TYPE_AUDIO;
if (!strcmp(buf, "dnet")) {
st->codec.codec_id = CODEC_ID_AC3;
st->codec->codec_id = CODEC_ID_AC3;
} else if (!strcmp(buf, "28_8")) {
st->codec.codec_id = CODEC_ID_RA_288;
st->codec.extradata_size= 10;
st->codec.extradata= av_mallocz(st->codec.extradata_size);
st->codec->codec_id = CODEC_ID_RA_288;
st->codec->extradata_size= 10;
st->codec->extradata= av_mallocz(st->codec->extradata_size);
/* this is completly braindead and broken, the idiot who added this codec and endianness
specific reordering to mplayer and libavcodec/ra288.c should be drowned in a see of cola */
//FIXME pass the unpermutated extradata
((uint16_t*)st->codec.extradata)[1]= sub_packet_h;
((uint16_t*)st->codec.extradata)[2]= flavor;
((uint16_t*)st->codec.extradata)[3]= coded_framesize;
((uint16_t*)st->codec->extradata)[1]= sub_packet_h;
((uint16_t*)st->codec->extradata)[2]= flavor;
((uint16_t*)st->codec->extradata)[3]= coded_framesize;
} else {
st->codec.codec_id = CODEC_ID_NONE;
pstrcpy(st->codec.codec_name, sizeof(st->codec.codec_name),
st->codec->codec_id = CODEC_ID_NONE;
pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name),
buf);
}
if (read_all) {
......@@ -635,7 +635,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto fail;
st->id = get_be16(pb);
get_be32(pb); /* max bit rate */
st->codec.bit_rate = get_be32(pb); /* bit rate */
st->codec->bit_rate = get_be32(pb); /* bit rate */
get_be32(pb); /* max packet size */
get_be32(pb); /* avg packet size */
start_time = get_be32(pb); /* start time */
......@@ -647,7 +647,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_str8(pb, buf, sizeof(buf)); /* mimetype */
codec_data_size = get_be32(pb);
codec_pos = url_ftell(pb);
st->codec.codec_type = CODEC_TYPE_DATA;
st->codec->codec_type = CODEC_TYPE_DATA;
av_set_pts_info(st, 64, 1, 1000);
v = get_be32(pb);
......@@ -658,43 +658,43 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
int fps, fps2;
if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
fail1:
av_log(&st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
goto skip;
}
st->codec.codec_tag = get_le32(pb);
// av_log(NULL, AV_LOG_DEBUG, "%X %X\n", st->codec.codec_tag, MKTAG('R', 'V', '2', '0'));
if ( st->codec.codec_tag != MKTAG('R', 'V', '1', '0')
&& st->codec.codec_tag != MKTAG('R', 'V', '2', '0')
&& st->codec.codec_tag != MKTAG('R', 'V', '3', '0')
&& st->codec.codec_tag != MKTAG('R', 'V', '4', '0'))
st->codec->codec_tag = get_le32(pb);
// av_log(NULL, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0')
&& st->codec->codec_tag != MKTAG('R', 'V', '2', '0')
&& st->codec->codec_tag != MKTAG('R', 'V', '3', '0')
&& st->codec->codec_tag != MKTAG('R', 'V', '4', '0'))
goto fail1;
st->codec.width = get_be16(pb);
st->codec.height = get_be16(pb);
st->codec.time_base.num= 1;
st->codec->width = get_be16(pb);
st->codec->height = get_be16(pb);
st->codec->time_base.num= 1;
fps= get_be16(pb);
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_type = CODEC_TYPE_VIDEO;
get_be32(pb);
fps2= get_be16(pb);
get_be16(pb);
st->codec.extradata_size= codec_data_size - (url_ftell(pb) - codec_pos);
st->codec.extradata= av_malloc(st->codec.extradata_size);
get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
st->codec->extradata_size= codec_data_size - (url_ftell(pb) - codec_pos);
st->codec->extradata= av_malloc(st->codec->extradata_size);
get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
// av_log(NULL, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
st->codec.time_base.den = fps * st->codec.time_base.num;
st->codec->time_base.den = fps * st->codec->time_base.num;
/* modification of h263 codec version (!) */
#ifdef WORDS_BIGENDIAN
h263_hack_version = ((uint32_t*)st->codec.extradata)[1];
h263_hack_version = ((uint32_t*)st->codec->extradata)[1];
#else
h263_hack_version = bswap_32(((uint32_t*)st->codec.extradata)[1]);
h263_hack_version = bswap_32(((uint32_t*)st->codec->extradata)[1]);
#endif
st->codec.sub_id = h263_hack_version;
st->codec->sub_id = h263_hack_version;
switch((h263_hack_version>>28)){
case 1: st->codec.codec_id = CODEC_ID_RV10; break;
case 2: st->codec.codec_id = CODEC_ID_RV20; break;
case 3: st->codec.codec_id = CODEC_ID_RV30; break;
case 4: st->codec.codec_id = CODEC_ID_RV40; break;
case 1: st->codec->codec_id = CODEC_ID_RV10; break;
case 2: st->codec->codec_id = CODEC_ID_RV20; break;
case 3: st->codec->codec_id = CODEC_ID_RV30; break;
case 4: st->codec->codec_id = CODEC_ID_RV40; break;
default: goto fail1;
}
}
......@@ -827,7 +827,7 @@ resync:
return AVERROR_IO;
st = s->streams[i];
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
int h, pic_num, len2, pos;
h= get_byte(pb); len--;
......@@ -862,8 +862,8 @@ resync:
pkt->stream_index = i;
#if 0
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
if(st->codec.codec_id == CODEC_ID_RV20){
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
if(st->codec->codec_id == CODEC_ID_RV20){
int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
av_log(NULL, AV_LOG_DEBUG, "%d %Ld %d\n", timestamp, timestamp*512LL/25, seq);
......@@ -882,7 +882,7 @@ resync:
}
/* for AC3, needs to swap bytes */
if (st->codec.codec_id == CODEC_ID_AC3) {
if (st->codec->codec_id == CODEC_ID_AC3) {
ptr = pkt->data;
for(j=0;j<len;j+=2) {
tmp = ptr[0];
......@@ -937,7 +937,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
return AV_NOPTS_VALUE;
st = s->streams[stream_index2];
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
h= get_byte(&s->pb); len--;
if(!(h & 0x40)){
seq = get_byte(&s->pb); len--;
......
......@@ -290,7 +290,7 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_t
return NULL;
}
} else {
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
case CODEC_ID_MP2:
......@@ -307,7 +307,6 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_t
static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
{
AVCodecContext codec;
int au_headers_length, au_header_size, i;
GetBitContext getbitcontext;
rtp_payload_data_t *infos;
......@@ -317,8 +316,6 @@ static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
if (infos == NULL)
return -1;
codec = s->st->codec;
/* decode the first 2 bytes where are stored the AUHeader sections
length in bits */
au_headers_length = BE_16(buf);
......@@ -407,7 +404,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
return -1;
#if defined(DEBUG) || 1
if (seq != ((s->seq + 1) & 0xffff)) {
av_log(&s->st->codec, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
av_log(s->st->codec, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
payload_type, seq, ((s->seq + 1) & 0xffff));
}
#endif
......@@ -428,7 +425,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
return 1;
}
} else {
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_MP2:
/* better than nothing: skip mpeg audio RTP header */
if (len <= 4)
......@@ -462,7 +459,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
break;
}
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_MP2:
case CODEC_ID_MPEG1VIDEO:
if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {
......@@ -529,7 +526,7 @@ static int rtp_write_header(AVFormatContext *s1)
return -1;
st = s1->streams[0];
payload_type = rtp_get_payload_type(&st->codec);
payload_type = rtp_get_payload_type(st->codec);
if (payload_type < 0)
payload_type = RTP_PT_PRIVATE; /* private payload type */
s->payload_type = payload_type;
......@@ -544,7 +541,7 @@ static int rtp_write_header(AVFormatContext *s1)
return AVERROR_IO;
s->max_payload_size = max_packet_size - 12;
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_MP2:
case CODEC_ID_MP3:
s->buf_ptr = s->buf + 4;
......@@ -663,7 +660,7 @@ static void rtp_send_mpegaudio(AVFormatContext *s1,
s->buf_ptr = s->buf + 4;
/* 90 KHz time stamp */
s->timestamp = s->base_timestamp +
(s->cur_timestamp * 90000LL) / st->codec.sample_rate;
(s->cur_timestamp * 90000LL) / st->codec->sample_rate;
}
}
......@@ -697,7 +694,7 @@ static void rtp_send_mpegaudio(AVFormatContext *s1,
memcpy(s->buf_ptr, buf1, size);
s->buf_ptr += size;
}
s->cur_timestamp += st->codec.frame_size;
s->cur_timestamp += st->codec->frame_size;
}
/* NOTE: a single frame must be passed with sequence header if
......@@ -715,7 +712,7 @@ static void rtp_send_mpegvideo(AVFormatContext *s1,
while (size > 0) {
/* XXX: more correct headers */
h = 0;
if (st->codec.sub_id == 2)
if (st->codec->sub_id == 2)
h |= 1 << 26; /* mpeg 2 indicator */
q = s->buf;
*q++ = h >> 24;
......@@ -723,7 +720,7 @@ static void rtp_send_mpegvideo(AVFormatContext *s1,
*q++ = h >> 8;
*q++ = h;
if (st->codec.sub_id == 2) {
if (st->codec->sub_id == 2) {
h = 0;
*q++ = h >> 24;
*q++ = h >> 16;
......@@ -740,7 +737,7 @@ static void rtp_send_mpegvideo(AVFormatContext *s1,
/* 90 KHz time stamp */
s->timestamp = s->base_timestamp +
av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps
av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps
rtp_send_data(s1, s->buf, q - s->buf);
buf1 += len;
......@@ -765,7 +762,7 @@ static void rtp_send_raw(AVFormatContext *s1,
/* 90 KHz time stamp */
s->timestamp = s->base_timestamp +
av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps
av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps
rtp_send_data(s1, buf1, len);
buf1 += len;
......@@ -824,18 +821,18 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
s->first_packet = 0;
}
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_PCM_MULAW:
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_S8:
rtp_send_samples(s1, buf1, size, 1 * st->codec.channels);
rtp_send_samples(s1, buf1, size, 1 * st->codec->channels);
break;
case CODEC_ID_PCM_U16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_S16LE:
rtp_send_samples(s1, buf1, size, 2 * st->codec.channels);
rtp_send_samples(s1, buf1, size, 2 * st->codec->channels);
break;
case CODEC_ID_MP2:
case CODEC_ID_MP3:
......
......@@ -282,7 +282,7 @@ static void sdp_parse_fmtp(AVStream *st, const char *p)
int i;
RTSPStream *rtsp_st = st->priv_data;
AVCodecContext *codec = &st->codec;
AVCodecContext *codec = st->codec;
rtp_payload_data_t *rtp_payload_data = &rtsp_st->rtp_payload_data;
/* loop on each attribute */
......@@ -405,10 +405,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
return;
st->priv_data = rtsp_st;
rtsp_st->stream_index = st->index;
st->codec.codec_type = codec_type;
st->codec->codec_type = codec_type;
if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
/* if standard payload type, we can find the codec right now */
rtp_get_codec_info(&st->codec, rtsp_st->sdp_payload_type);
rtp_get_codec_info(st->codec, rtsp_st->sdp_payload_type);
}
}
/* put a default control url */
......@@ -438,7 +438,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
st = s->streams[i];
rtsp_st = st->priv_data;
if (rtsp_st->sdp_payload_type == payload_type) {
sdp_parse_rtpmap(&st->codec, payload_type, p);
sdp_parse_rtpmap(st->codec, payload_type, p);
}
}
} else if (strstart(p, "fmtp:", &p)) {
......
......@@ -140,11 +140,11 @@ static int film_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
film->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = film->video_type;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = BE_32(&scratch[16]);
st->codec.height = BE_32(&scratch[12]);
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = film->video_type;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = BE_32(&scratch[16]);
st->codec->height = BE_32(&scratch[12]);
}
if (film->audio_type) {
......@@ -152,16 +152,16 @@ static int film_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
film->audio_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = film->audio_type;
st->codec.codec_tag = 1;
st->codec.channels = film->audio_channels;
st->codec.bits_per_sample = film->audio_bits;
st->codec.sample_rate = film->audio_samplerate;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample;
st->codec.block_align = st->codec.channels *
st->codec.bits_per_sample / 8;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = film->audio_type;
st->codec->codec_tag = 1;
st->codec->channels = film->audio_channels;
st->codec->bits_per_sample = film->audio_bits;
st->codec->sample_rate = film->audio_samplerate;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
st->codec->block_align = st->codec->channels *
st->codec->bits_per_sample / 8;
}
/* load the sample table */
......
......@@ -131,14 +131,14 @@ static int vmd_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
vmd->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_VMDVIDEO;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = LE_16(&vmd->vmd_header[12]);
st->codec.height = LE_16(&vmd->vmd_header[14]);
st->codec.extradata_size = VMD_HEADER_SIZE;
st->codec.extradata = av_malloc(VMD_HEADER_SIZE);
memcpy(st->codec.extradata, vmd->vmd_header, VMD_HEADER_SIZE);
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_VMDVIDEO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = LE_16(&vmd->vmd_header[12]);
st->codec->height = LE_16(&vmd->vmd_header[14]);
st->codec->extradata_size = VMD_HEADER_SIZE;
st->codec->extradata = av_malloc(VMD_HEADER_SIZE);
memcpy(st->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE);
/* if sample rate is 0, assume no audio */
vmd->sample_rate = LE_16(&vmd->vmd_header[804]);
......@@ -148,29 +148,29 @@ static int vmd_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
vmd->audio_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_VMDAUDIO;
st->codec.codec_tag = 0; /* no codec tag */
st->codec.channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
st->codec.sample_rate = vmd->sample_rate;
st->codec.block_align = vmd->audio_block_align =
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_VMDAUDIO;
st->codec->codec_tag = 0; /* no codec tag */
st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
st->codec->sample_rate = vmd->sample_rate;
st->codec->block_align = vmd->audio_block_align =
LE_16(&vmd->vmd_header[806]);
if (st->codec.block_align & 0x8000) {
st->codec.bits_per_sample = 16;
st->codec.block_align = -(st->codec.block_align - 0x10000);
if (st->codec->block_align & 0x8000) {
st->codec->bits_per_sample = 16;
st->codec->block_align = -(st->codec->block_align - 0x10000);
} else
st->codec.bits_per_sample = 16;
// st->codec.bits_per_sample = 8;
st->codec.bit_rate = st->codec.sample_rate *
st->codec.bits_per_sample * st->codec.channels;
st->codec->bits_per_sample = 16;
// st->codec->bits_per_sample = 8;
st->codec->bit_rate = st->codec->sample_rate *
st->codec->bits_per_sample * st->codec->channels;
/* for calculating pts */
vmd->audio_frame_divisor = st->codec.bits_per_sample / 8 /
st->codec.channels;
vmd->audio_frame_divisor = st->codec->bits_per_sample / 8 /
st->codec->channels;
video_pts_inc = 90000;
video_pts_inc *= st->codec.block_align;
video_pts_inc /= st->codec.sample_rate;
video_pts_inc *= st->codec->block_align;
video_pts_inc /= st->codec->sample_rate;
} else {
/* if no audio, assume 10 frames/second */
video_pts_inc = 90000 / 10;
......
......@@ -113,11 +113,11 @@ static int sol_read_header(AVFormatContext *s,
st = av_new_stream(s, 0);
if (!st)
return -1;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_tag = id;
st->codec.codec_id = codec;
st->codec.channels = channels;
st->codec.sample_rate = rate;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->sample_rate = rate;
av_set_pts_info(st, 64, 1, rate);
return 0;
}
......
......@@ -324,7 +324,7 @@ static int swf_write_header(AVFormatContext *s)
video_enc = NULL;
audio_enc = NULL;
for(i=0;i<s->nb_streams;i++) {
enc = &s->streams[i]->codec;
enc = s->streams[i]->codec;
if (enc->codec_type == CODEC_TYPE_AUDIO)
audio_enc = enc;
else {
......@@ -652,7 +652,7 @@ static int swf_write_audio(AVFormatContext *s,
static int swf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVCodecContext *codec = &s->streams[pkt->stream_index]->codec;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
if (codec->codec_type == CODEC_TYPE_AUDIO)
return swf_write_audio(s, codec, pkt->data, pkt->size);
else
......@@ -668,7 +668,7 @@ static int swf_write_trailer(AVFormatContext *s)
video_enc = NULL;
for(i=0;i<s->nb_streams;i++) {
enc = &s->streams[i]->codec;
enc = s->streams[i]->codec;
if (enc->codec_type == CODEC_TYPE_VIDEO)
video_enc = enc;
}
......@@ -775,8 +775,8 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (tag < 0) {
if ( ast || vst ) {
if ( vst && ast ) {
vst->codec.time_base.den = ast->codec.sample_rate / swf->samples_per_frame;
vst->codec.time_base.num = 1;
vst->codec->time_base.den = ast->codec->sample_rate / swf->samples_per_frame;
vst->codec->time_base.num = 1;
}
break;
}
......@@ -794,11 +794,11 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
vst = av_new_stream(s, 0);
av_set_pts_info(vst, 24, 1, 1000); /* 24 bit pts in ms */
vst->codec.codec_type = CODEC_TYPE_VIDEO;
vst->codec.codec_id = CODEC_ID_FLV1;
vst->codec->codec_type = CODEC_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_FLV1;
if ( swf->samples_per_frame ) {
vst->codec.time_base.den = 1000. / swf->ms_per_frame;
vst->codec.time_base.num = 1;
vst->codec->time_base.den = 1000. / swf->ms_per_frame;
vst->codec->time_base.num = 1;
}
}
} else if ( ( tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2 ) && !ast) {
......@@ -819,26 +819,26 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -ENOMEM;
if (v & 0x01)
ast->codec.channels = 2;
ast->codec->channels = 2;
else
ast->codec.channels = 1;
ast->codec->channels = 1;
switch((v>> 2) & 0x03) {
case 1:
ast->codec.sample_rate = 11025;
ast->codec->sample_rate = 11025;
break;
case 2:
ast->codec.sample_rate = 22050;
ast->codec->sample_rate = 22050;
break;
case 3:
ast->codec.sample_rate = 44100;
ast->codec->sample_rate = 44100;
break;
default:
av_free(ast);
return AVERROR_IO;
}
ast->codec.codec_type = CODEC_TYPE_AUDIO;
ast->codec.codec_id = CODEC_ID_MP3;
ast->codec->codec_type = CODEC_TYPE_AUDIO;
ast->codec->codec_id = CODEC_ID_MP3;
}
} else {
url_fskip(pb, len);
......
This diff is collapsed.
......@@ -199,13 +199,13 @@ static int wav_write_header(AVFormatContext *s)
/* format header */
fmt = start_tag(pb, "fmt ");
if (put_wav_header(pb, &s->streams[0]->codec) < 0) {
if (put_wav_header(pb, s->streams[0]->codec) < 0) {
av_free(wav);
return -1;
}
end_tag(pb, fmt);
av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec.sample_rate);
av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
/* data header */
wav->data = start_tag(pb, "data");
......@@ -305,10 +305,10 @@ static int wav_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
get_wav_header(pb, &st->codec, size);
get_wav_header(pb, st->codec, size);
st->need_parsing = 1;
av_set_pts_info(st, 64, 1, st->codec.sample_rate);
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
if (size < 0)
......@@ -329,10 +329,10 @@ static int wav_read_packet(AVFormatContext *s,
st = s->streams[0];
size = MAX_SIZE;
if (st->codec.block_align > 1) {
if (size < st->codec.block_align)
size = st->codec.block_align;
size = (size / st->codec.block_align) * st->codec.block_align;
if (st->codec->block_align > 1) {
if (size < st->codec->block_align)
size = st->codec->block_align;
size = (size / st->codec->block_align) * st->codec->block_align;
}
if (av_new_packet(pkt, size))
return AVERROR_IO;
......@@ -358,7 +358,7 @@ static int wav_read_seek(AVFormatContext *s,
AVStream *st;
st = s->streams[0];
switch(st->codec.codec_id) {
switch(st->codec->codec_id) {
case CODEC_ID_MP2:
case CODEC_ID_MP3:
case CODEC_ID_AC3:
......
......@@ -239,29 +239,29 @@ static int wc3_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
wc3->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_XAN_WC3;
st->codec.codec_tag = 0; /* no fourcc */
st->codec.width = wc3->width;
st->codec.height = wc3->height;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_XAN_WC3;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = wc3->width;
st->codec->height = wc3->height;
/* palette considerations */
st->codec.palctrl = &wc3->palette_control;
st->codec->palctrl = &wc3->palette_control;
st = av_new_stream(s, 0);
if (!st)
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
wc3->audio_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_PCM_S16LE;
st->codec.codec_tag = 1;
st->codec.channels = WC3_AUDIO_CHANNELS;
st->codec.bits_per_sample = WC3_AUDIO_BITS;
st->codec.sample_rate = WC3_SAMPLE_RATE;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample;
st->codec.block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_PCM_S16LE;
st->codec->codec_tag = 1;
st->codec->channels = WC3_AUDIO_CHANNELS;
st->codec->bits_per_sample = WC3_AUDIO_BITS;
st->codec->sample_rate = WC3_SAMPLE_RATE;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
return 0;
}
......
......@@ -136,15 +136,15 @@ static int wsaud_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = wsaud->audio_type;
st->codec.codec_tag = 0; /* no tag */
st->codec.channels = wsaud->audio_channels;
st->codec.sample_rate = wsaud->audio_samplerate;
st->codec.bits_per_sample = wsaud->audio_bits;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample / 4;
st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = wsaud->audio_type;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = wsaud->audio_channels;
st->codec->sample_rate = wsaud->audio_samplerate;
st->codec->bits_per_sample = wsaud->audio_bits;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample / 4;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
wsaud->audio_stream_index = st->index;
wsaud->audio_frame_counter = 0;
......@@ -222,24 +222,24 @@ static int wsvqa_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
wsvqa->video_stream_index = st->index;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_WS_VQA;
st->codec.codec_tag = 0; /* no fourcc */
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_WS_VQA;
st->codec->codec_tag = 0; /* no fourcc */
/* skip to the start of the VQA header */
url_fseek(pb, 20, SEEK_SET);
/* the VQA header needs to go to the decoder */
st->codec.extradata_size = VQA_HEADER_SIZE;
st->codec.extradata = av_malloc(VQA_HEADER_SIZE);
header = (unsigned char *)st->codec.extradata;
if (get_buffer(pb, st->codec.extradata, VQA_HEADER_SIZE) !=
st->codec->extradata_size = VQA_HEADER_SIZE;
st->codec->extradata = av_malloc(VQA_HEADER_SIZE);
header = (unsigned char *)st->codec->extradata;
if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
VQA_HEADER_SIZE) {
av_free(st->codec.extradata);
av_free(st->codec->extradata);
return AVERROR_IO;
}
st->codec.width = LE_16(&header[6]);
st->codec.height = LE_16(&header[8]);
st->codec->width = LE_16(&header[6]);
st->codec->height = LE_16(&header[8]);
/* initialize the audio decoder stream is sample rate is non-zero */
if (LE_16(&header[24])) {
......@@ -247,19 +247,19 @@ static int wsvqa_read_header(AVFormatContext *s,
if (!st)
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_ADPCM_IMA_WS;
st->codec.codec_tag = 0; /* no tag */
st->codec.sample_rate = LE_16(&header[24]);
st->codec.channels = header[26];
st->codec.bits_per_sample = 16;
st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
st->codec.bits_per_sample / 4;
st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
st->codec->codec_tag = 0; /* no tag */
st->codec->sample_rate = LE_16(&header[24]);
st->codec->channels = header[26];
st->codec->bits_per_sample = 16;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample / 4;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
wsvqa->audio_stream_index = st->index;
wsvqa->audio_samplerate = st->codec.sample_rate;
wsvqa->audio_channels = st->codec.channels;
wsvqa->audio_samplerate = st->codec->sample_rate;
wsvqa->audio_channels = st->codec->channels;
wsvqa->audio_frame_counter = 0;
}
......@@ -267,7 +267,7 @@ static int wsvqa_read_header(AVFormatContext *s,
* FINF has been skipped and the file will be ready to be demuxed */
do {
if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
av_free(st->codec.extradata);
av_free(st->codec->extradata);
return AVERROR_IO;
}
chunk_tag = BE_32(&scratch[0]);
......
......@@ -33,22 +33,22 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
char *colorspace = "";
st = s->streams[0];
width = st->codec.width;
height = st->codec.height;
width = st->codec->width;
height = st->codec->height;
av_reduce(&raten, &rated, st->codec.time_base.den, st->codec.time_base.num, (1UL<<31)-1);
av_reduce(&raten, &rated, st->codec->time_base.den, st->codec->time_base.num, (1UL<<31)-1);
aspectn = st->codec.sample_aspect_ratio.num;
aspectd = st->codec.sample_aspect_ratio.den;
aspectn = st->codec->sample_aspect_ratio.num;
aspectd = st->codec->sample_aspect_ratio.den;
if ( aspectn == 0 && aspectd == 1 ) aspectd = 0; // 0:0 means unknown
inter = 'p'; /* progressive is the default */
if (st->codec.coded_frame && st->codec.coded_frame->interlaced_frame) {
inter = st->codec.coded_frame->top_field_first ? 't' : 'b';
if (st->codec->coded_frame && st->codec->coded_frame->interlaced_frame) {
inter = st->codec->coded_frame->top_field_first ? 't' : 'b';
}
switch(st->codec.pix_fmt) {
switch(st->codec->pix_fmt) {
case PIX_FMT_GRAY8:
colorspace = " Cmono";
break;
......@@ -56,7 +56,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
colorspace = " C411 XYSCSS=411";
break;
case PIX_FMT_YUV420P:
colorspace = (st->codec.codec_id == CODEC_ID_DVVIDEO)?" C420paldv XYSCSS=420PALDV":" C420mpeg2 XYSCSS=420MPEG2";
colorspace = (st->codec->codec_id == CODEC_ID_DVVIDEO)?" C420paldv XYSCSS=420PALDV":" C420mpeg2 XYSCSS=420MPEG2";
break;
case PIX_FMT_YUV422P:
colorspace = " C422 XYSCSS=422";
......@@ -109,8 +109,8 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
m = snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC);
put_buffer(pb, buf1, strlen(buf1));
width = st->codec.width;
height = st->codec.height;
width = st->codec->width;
height = st->codec->height;
ptr = picture->data[0];
for(i=0;i<height;i++) {
......@@ -118,9 +118,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
ptr += picture->linesize[0];
}
if (st->codec.pix_fmt != PIX_FMT_GRAY8){
if (st->codec->pix_fmt != PIX_FMT_GRAY8){
// Adjust for smaller Cb and Cr planes
avcodec_get_chroma_sub_sample(st->codec.pix_fmt, &h_chroma_shift, &v_chroma_shift);
avcodec_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift, &v_chroma_shift);
width >>= h_chroma_shift;
height >>= v_chroma_shift;
......@@ -146,13 +146,13 @@ static int yuv4_write_header(AVFormatContext *s)
if (s->nb_streams != 1)
return AVERROR_IO;
if (s->streams[0]->codec.pix_fmt == PIX_FMT_YUV411P) {
if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) {
av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n");
}
else if ((s->streams[0]->codec.pix_fmt != PIX_FMT_YUV420P) &&
(s->streams[0]->codec.pix_fmt != PIX_FMT_YUV422P) &&
(s->streams[0]->codec.pix_fmt != PIX_FMT_GRAY8) &&
(s->streams[0]->codec.pix_fmt != PIX_FMT_YUV444P)) {
else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) &&
(s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) &&
(s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) &&
(s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) {
av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n");
return AVERROR_IO;
}
......@@ -320,14 +320,14 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = av_new_stream(s, 0);
st = s->streams[0];
st->codec.width = width;
st->codec.height = height;
st->codec->width = width;
st->codec->height = height;
av_reduce(&raten, &rated, raten, rated, (1UL<<31)-1);
av_set_pts_info(st, 64, rated, raten);
st->codec.pix_fmt = pix_fmt;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_RAWVIDEO;
st->codec.sample_aspect_ratio= (AVRational){aspectn, aspectd};
st->codec->pix_fmt = pix_fmt;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->sample_aspect_ratio= (AVRational){aspectn, aspectd};
return 0;
}
......@@ -349,10 +349,10 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
if (i == MAX_FRAME_HEADER) return -1;
if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC))) return -1;
width = st->codec.width;
height = st->codec.height;
width = st->codec->width;
height = st->codec->height;
packet_size = avpicture_get_size(st->codec.pix_fmt, width, height);
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
if (packet_size < 0)
return -1;
......
......@@ -62,7 +62,7 @@ AVStream *add_audio_stream(AVFormatContext *oc, int codec_id)
exit(1);
}
c = &st->codec;
c = st->codec;
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_AUDIO;
......@@ -78,7 +78,7 @@ void open_audio(AVFormatContext *oc, AVStream *st)
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 @@ void open_audio(AVFormatContext *oc, AVStream *st)
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 @@ void write_audio_frame(AVFormatContext *oc, AVStream *st)
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 write_audio_frame(AVFormatContext *oc, AVStream *st)
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 @@ AVStream *add_video_stream(AVFormatContext *oc, int codec_id)
exit(1);
}
c = &st->codec;
c = st->codec;
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_VIDEO;
......@@ -246,7 +246,7 @@ void open_video(AVFormatContext *oc, AVStream *st)
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 @@ void write_video_frame(AVFormatContext *oc, AVStream *st)
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 write_video_frame(AVFormatContext *oc, AVStream *st)
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment