diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2008-08-23 23:43:20 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2008-08-23 23:43:20 +0000 |
commit | 5972945197d44e8bde6a986b9cba2e8196cfbc9c (patch) | |
tree | 94ba719e6f5efb53fc18d7eb38ccb96d25e7b194 /libavformat/nutenc.c | |
parent | c30a4489b444020ef951c1f0583afd8679c07c78 (diff) | |
download | ffmpeg-5972945197d44e8bde6a986b9cba2e8196cfbc9c.tar.gz |
convert every muxer/demuxer to write/read sample_aspect_ratio from/to
the corresponding AVStream instead of AVCodecContext
Originally committed as revision 14933 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/nutenc.c')
-rw-r--r-- | libavformat/nutenc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 447cea31a0..7bb826a891 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -389,7 +389,8 @@ static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ } } -static int write_streamheader(NUTContext *nut, ByteIOContext *bc, AVCodecContext *codec, int i){ +static int write_streamheader(NUTContext *nut, ByteIOContext *bc, AVStream *st, int i){ + AVCodecContext *codec = st->codec; put_v(bc, i); switch(codec->codec_type){ case CODEC_TYPE_VIDEO: put_v(bc, 0); break; @@ -422,12 +423,12 @@ static int write_streamheader(NUTContext *nut, ByteIOContext *bc, AVCodecContext put_v(bc, codec->width); put_v(bc, codec->height); - if(codec->sample_aspect_ratio.num<=0 || codec->sample_aspect_ratio.den<=0){ + if(st->sample_aspect_ratio.num<=0 || st->sample_aspect_ratio.den<=0){ put_v(bc, 0); put_v(bc, 0); }else{ - put_v(bc, codec->sample_aspect_ratio.num); - put_v(bc, codec->sample_aspect_ratio.den); + put_v(bc, st->sample_aspect_ratio.num); + put_v(bc, st->sample_aspect_ratio.den); } put_v(bc, 0); /* csp type -- unknown */ break; @@ -514,12 +515,10 @@ static int write_headers(NUTContext *nut, ByteIOContext *bc){ put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE); for (i=0; i < nut->avf->nb_streams; i++){ - AVCodecContext *codec = nut->avf->streams[i]->codec; - ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; - write_streamheader(nut, dyn_bc, codec, i); + write_streamheader(nut, dyn_bc, nut->avf->streams[i], i); put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE); } |