mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
add av_new_stream() usage
Originally committed as revision 2109 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
ee40480319
commit
fa26a29d65
@ -140,16 +140,9 @@ static int au_read_header(AVFormatContext *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* now we are ready: build format streams */
|
/* now we are ready: build format streams */
|
||||||
st = av_malloc(sizeof(AVStream));
|
st = av_new_stream(s, 0);
|
||||||
if (!st)
|
if (!st)
|
||||||
return -1;
|
return -1;
|
||||||
avcodec_get_context_defaults(&st->codec);
|
|
||||||
|
|
||||||
s->nb_streams = 1;
|
|
||||||
s->streams[0] = st;
|
|
||||||
|
|
||||||
st->id = 0;
|
|
||||||
|
|
||||||
st->codec.codec_type = CODEC_TYPE_AUDIO;
|
st->codec.codec_type = CODEC_TYPE_AUDIO;
|
||||||
st->codec.codec_tag = id;
|
st->codec.codec_tag = id;
|
||||||
st->codec.codec_id = codec;
|
st->codec.codec_id = codec;
|
||||||
|
@ -368,7 +368,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
FFMStream *fst;
|
FFMStream *fst;
|
||||||
ByteIOContext *pb = &s->pb;
|
ByteIOContext *pb = &s->pb;
|
||||||
AVCodecContext *codec;
|
AVCodecContext *codec;
|
||||||
int i;
|
int i, nb_streams;
|
||||||
uint32_t tag;
|
uint32_t tag;
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
@ -386,17 +386,15 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
ffm->file_size = (uint64_t_C(1) << 63) - 1;
|
ffm->file_size = (uint64_t_C(1) << 63) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->nb_streams = get_be32(pb);
|
nb_streams = get_be32(pb);
|
||||||
get_be32(pb); /* total bitrate */
|
get_be32(pb); /* total bitrate */
|
||||||
/* read each stream */
|
/* read each stream */
|
||||||
for(i=0;i<s->nb_streams;i++) {
|
for(i=0;i<nb_streams;i++) {
|
||||||
char rc_eq_buf[128];
|
char rc_eq_buf[128];
|
||||||
|
|
||||||
st = av_mallocz(sizeof(AVStream));
|
st = av_new_stream(s, 0);
|
||||||
if (!st)
|
if (!st)
|
||||||
goto fail;
|
goto fail;
|
||||||
avcodec_get_context_defaults(&st->codec);
|
|
||||||
s->streams[i] = st;
|
|
||||||
fst = av_mallocz(sizeof(FFMStream));
|
fst = av_mallocz(sizeof(FFMStream));
|
||||||
if (!fst)
|
if (!fst)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -611,7 +609,7 @@ offset_t ffm_read_write_index(int fd)
|
|||||||
read(fd, buf, 8);
|
read(fd, buf, 8);
|
||||||
pos = 0;
|
pos = 0;
|
||||||
for(i=0;i<8;i++)
|
for(i=0;i<8;i++)
|
||||||
pos |= buf[i] << (56 - i * 8);
|
pos |= (int64_t)buf[i] << (56 - i * 8);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,17 +481,14 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
get_le16(pb);
|
get_le16(pb);
|
||||||
/* if mp3 streaming found, OK */
|
/* if mp3 streaming found, OK */
|
||||||
if ((v & 0x20) != 0) {
|
if ((v & 0x20) != 0) {
|
||||||
st = av_mallocz(sizeof(AVStream));
|
st = av_new_stream(s, 0);
|
||||||
if (!st)
|
if (!st)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
avcodec_get_context_defaults(&st->codec);
|
|
||||||
|
|
||||||
if (v & 0x01)
|
if (v & 0x01)
|
||||||
st->codec.channels = 2;
|
st->codec.channels = 2;
|
||||||
else
|
else
|
||||||
st->codec.channels = 1;
|
st->codec.channels = 1;
|
||||||
s->nb_streams = 1;
|
|
||||||
s->streams[0] = st;
|
|
||||||
|
|
||||||
switch((v>> 2) & 0x03) {
|
switch((v>> 2) & 0x03) {
|
||||||
case 1:
|
case 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user