Merge remote-tracking branch 'qatar/master'
* qatar/master: pthread: add some malloc failure checks avconv: cosmetics, reformat transcode_init() avconv: rename 'os' variable to 'oc' doc/filters: fix some typos. configure: add libpulse to help output Conflicts: avconv.c configure Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
42
avconv.c
42
avconv.c
@@ -2027,7 +2027,7 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
int nb_input_files)
|
int nb_input_files)
|
||||||
{
|
{
|
||||||
int ret = 0, i, j, k;
|
int ret = 0, i, j, k;
|
||||||
AVFormatContext *os;
|
AVFormatContext *oc;
|
||||||
AVCodecContext *codec, *icodec;
|
AVCodecContext *codec, *icodec;
|
||||||
OutputStream *ost;
|
OutputStream *ost;
|
||||||
InputStream *ist;
|
InputStream *ist;
|
||||||
@@ -2044,9 +2044,9 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
|
|
||||||
/* output stream init */
|
/* output stream init */
|
||||||
for (i = 0; i < nb_output_files; i++) {
|
for (i = 0; i < nb_output_files; i++) {
|
||||||
os = output_files[i].ctx;
|
oc = output_files[i].ctx;
|
||||||
if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) {
|
if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
|
||||||
av_dump_format(os, i, os->filename, 1);
|
av_dump_format(oc, i, oc->filename, 1);
|
||||||
av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i);
|
av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
@@ -2055,7 +2055,7 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
/* for each output stream, we compute the right encoding parameters */
|
/* for each output stream, we compute the right encoding parameters */
|
||||||
for (i = 0; i < nb_output_streams; i++) {
|
for (i = 0; i < nb_output_streams; i++) {
|
||||||
ost = &output_streams[i];
|
ost = &output_streams[i];
|
||||||
os = output_files[ost->file_index].ctx;
|
oc = output_files[ost->file_index].ctx;
|
||||||
ist = &input_streams[ost->source_index];
|
ist = &input_streams[ost->source_index];
|
||||||
|
|
||||||
if (ost->attachment_filename)
|
if (ost->attachment_filename)
|
||||||
@@ -2080,9 +2080,9 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
codec->codec_type = icodec->codec_type;
|
codec->codec_type = icodec->codec_type;
|
||||||
|
|
||||||
if (!codec->codec_tag) {
|
if (!codec->codec_tag) {
|
||||||
if( !os->oformat->codec_tag
|
if (!oc->oformat->codec_tag ||
|
||||||
|| av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) == codec->codec_id
|
av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id ||
|
||||||
|| av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0)
|
av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0)
|
||||||
codec->codec_tag = icodec->codec_tag;
|
codec->codec_tag = icodec->codec_tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2097,13 +2097,15 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
codec->extradata_size= icodec->extradata_size;
|
codec->extradata_size= icodec->extradata_size;
|
||||||
|
|
||||||
codec->time_base = ist->st->time_base;
|
codec->time_base = ist->st->time_base;
|
||||||
if(!strcmp(os->oformat->name, "avi")) {
|
if(!strcmp(oc->oformat->name, "avi")) {
|
||||||
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
if (!copy_tb &&
|
||||||
|
av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) &&
|
||||||
|
av_q2d(ist->st->time_base) < 1.0/500){
|
||||||
codec->time_base = icodec->time_base;
|
codec->time_base = icodec->time_base;
|
||||||
codec->time_base.num *= icodec->ticks_per_frame;
|
codec->time_base.num *= icodec->ticks_per_frame;
|
||||||
codec->time_base.den *= 2;
|
codec->time_base.den *= 2;
|
||||||
}
|
}
|
||||||
} else if(!(os->oformat->flags & AVFMT_VARIABLE_FPS)) {
|
} else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS)) {
|
||||||
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
||||||
codec->time_base = icodec->time_base;
|
codec->time_base = icodec->time_base;
|
||||||
codec->time_base.num *= icodec->ticks_per_frame;
|
codec->time_base.num *= icodec->ticks_per_frame;
|
||||||
@@ -2151,8 +2153,10 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
} else {
|
} else {
|
||||||
if (!ost->enc)
|
if (!ost->enc)
|
||||||
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
||||||
|
|
||||||
ist->decoding_needed = 1;
|
ist->decoding_needed = 1;
|
||||||
ost->encoding_needed = 1;
|
ost->encoding_needed = 1;
|
||||||
|
|
||||||
switch(codec->codec_type) {
|
switch(codec->codec_type) {
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
ost->fifo = av_fifo_alloc(1024);
|
ost->fifo = av_fifo_alloc(1024);
|
||||||
@@ -2160,19 +2164,23 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
|
ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
|
||||||
|
|
||||||
if (!codec->sample_rate)
|
if (!codec->sample_rate)
|
||||||
codec->sample_rate = icodec->sample_rate;
|
codec->sample_rate = icodec->sample_rate;
|
||||||
choose_sample_rate(ost->st, ost->enc);
|
choose_sample_rate(ost->st, ost->enc);
|
||||||
codec->time_base = (AVRational){1, codec->sample_rate};
|
codec->time_base = (AVRational){1, codec->sample_rate};
|
||||||
|
|
||||||
if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
|
if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
|
||||||
codec->sample_fmt = icodec->sample_fmt;
|
codec->sample_fmt = icodec->sample_fmt;
|
||||||
choose_sample_fmt(ost->st, ost->enc);
|
choose_sample_fmt(ost->st, ost->enc);
|
||||||
|
|
||||||
if (!codec->channels) {
|
if (!codec->channels) {
|
||||||
codec->channels = icodec->channels;
|
codec->channels = icodec->channels;
|
||||||
codec->channel_layout = icodec->channel_layout;
|
codec->channel_layout = icodec->channel_layout;
|
||||||
}
|
}
|
||||||
if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
|
if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
|
||||||
codec->channel_layout = 0;
|
codec->channel_layout = 0;
|
||||||
|
|
||||||
ost->audio_resample = codec-> sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
ost->audio_resample = codec-> sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
||||||
icodec->request_channels = codec-> channels;
|
icodec->request_channels = codec-> channels;
|
||||||
ost->resample_sample_fmt = icodec->sample_fmt;
|
ost->resample_sample_fmt = icodec->sample_fmt;
|
||||||
@@ -2213,8 +2221,8 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
}
|
}
|
||||||
codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num};
|
codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num};
|
||||||
if( av_q2d(codec->time_base) < 0.001 && video_sync_method
|
if( av_q2d(codec->time_base) < 0.001 && video_sync_method
|
||||||
&& (video_sync_method==1 || (video_sync_method<0 && !(os->oformat->flags & AVFMT_VARIABLE_FPS)))){
|
&& (video_sync_method==1 || (video_sync_method<0 && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){
|
||||||
av_log(os, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n"
|
av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n"
|
||||||
"Please consider specifiying a lower framerate, a different muxer or -vsync 2\n");
|
"Please consider specifiying a lower framerate, a different muxer or -vsync 2\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2337,15 +2345,15 @@ static int transcode_init(OutputFile *output_files,
|
|||||||
|
|
||||||
/* open files and write file headers */
|
/* open files and write file headers */
|
||||||
for (i = 0; i < nb_output_files; i++) {
|
for (i = 0; i < nb_output_files; i++) {
|
||||||
os = output_files[i].ctx;
|
oc = output_files[i].ctx;
|
||||||
os->interrupt_callback = int_cb;
|
oc->interrupt_callback = int_cb;
|
||||||
if (avformat_write_header(os, &output_files[i].opts) < 0) {
|
if (avformat_write_header(oc, &output_files[i].opts) < 0) {
|
||||||
snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
|
snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto dump_format;
|
goto dump_format;
|
||||||
}
|
}
|
||||||
// assert_avoptions(output_files[i].opts);
|
// assert_avoptions(output_files[i].opts);
|
||||||
if (strcmp(os->oformat->name, "rtp")) {
|
if (strcmp(oc->oformat->name, "rtp")) {
|
||||||
want_sdp = 0;
|
want_sdp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
configure
vendored
1
configure
vendored
@@ -184,6 +184,7 @@ External library support:
|
|||||||
--enable-libnut enable NUT (de)muxing via libnut,
|
--enable-libnut enable NUT (de)muxing via libnut,
|
||||||
native (de)muxer exists [no]
|
native (de)muxer exists [no]
|
||||||
--enable-libopenjpeg enable JPEG 2000 encoding/decoding via OpenJPEG [no]
|
--enable-libopenjpeg enable JPEG 2000 encoding/decoding via OpenJPEG [no]
|
||||||
|
--enable-libpulse enable Pulseaudio input via libpulse [no]
|
||||||
--enable-librtmp enable RTMP[E] support via librtmp [no]
|
--enable-librtmp enable RTMP[E] support via librtmp [no]
|
||||||
--enable-libschroedinger enable Dirac support via libschroedinger [no]
|
--enable-libschroedinger enable Dirac support via libschroedinger [no]
|
||||||
--enable-libspeex enable Speex support via libspeex [no]
|
--enable-libspeex enable Speex support via libspeex [no]
|
||||||
|
41
ffmpeg.c
41
ffmpeg.c
@@ -2071,7 +2071,7 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
InputFile *input_files, int nb_input_files)
|
InputFile *input_files, int nb_input_files)
|
||||||
{
|
{
|
||||||
int ret = 0, i, j, k;
|
int ret = 0, i, j, k;
|
||||||
AVFormatContext *os;
|
AVFormatContext *oc;
|
||||||
AVCodecContext *codec, *icodec;
|
AVCodecContext *codec, *icodec;
|
||||||
OutputStream *ost;
|
OutputStream *ost;
|
||||||
InputStream *ist;
|
InputStream *ist;
|
||||||
@@ -2088,9 +2088,9 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
|
|
||||||
/* output stream init */
|
/* output stream init */
|
||||||
for (i = 0; i < nb_output_files; i++) {
|
for (i = 0; i < nb_output_files; i++) {
|
||||||
os = output_files[i].ctx;
|
oc = output_files[i].ctx;
|
||||||
if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) {
|
if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
|
||||||
av_dump_format(os, i, os->filename, 1);
|
av_dump_format(oc, i, oc->filename, 1);
|
||||||
av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i);
|
av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
@@ -2099,7 +2099,7 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
/* for each output stream, we compute the right encoding parameters */
|
/* for each output stream, we compute the right encoding parameters */
|
||||||
for (i = 0; i < nb_output_streams; i++) {
|
for (i = 0; i < nb_output_streams; i++) {
|
||||||
ost = &output_streams[i];
|
ost = &output_streams[i];
|
||||||
os = output_files[ost->file_index].ctx;
|
oc = output_files[ost->file_index].ctx;
|
||||||
ist = &input_streams[ost->source_index];
|
ist = &input_streams[ost->source_index];
|
||||||
|
|
||||||
if (ost->attachment_filename)
|
if (ost->attachment_filename)
|
||||||
@@ -2124,9 +2124,9 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
codec->codec_type = icodec->codec_type;
|
codec->codec_type = icodec->codec_type;
|
||||||
|
|
||||||
if (!codec->codec_tag) {
|
if (!codec->codec_tag) {
|
||||||
if( !os->oformat->codec_tag
|
if (!oc->oformat->codec_tag ||
|
||||||
|| av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) == codec->codec_id
|
av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id ||
|
||||||
|| av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0)
|
av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0)
|
||||||
codec->codec_tag = icodec->codec_tag;
|
codec->codec_tag = icodec->codec_tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2141,13 +2141,15 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
codec->extradata_size= icodec->extradata_size;
|
codec->extradata_size= icodec->extradata_size;
|
||||||
|
|
||||||
codec->time_base = ist->st->time_base;
|
codec->time_base = ist->st->time_base;
|
||||||
if(!strcmp(os->oformat->name, "avi")) {
|
if(!strcmp(oc->oformat->name, "avi")) {
|
||||||
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
if (!copy_tb &&
|
||||||
|
av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) &&
|
||||||
|
av_q2d(ist->st->time_base) < 1.0/500){
|
||||||
codec->time_base = icodec->time_base;
|
codec->time_base = icodec->time_base;
|
||||||
codec->time_base.num *= icodec->ticks_per_frame;
|
codec->time_base.num *= icodec->ticks_per_frame;
|
||||||
codec->time_base.den *= 2;
|
codec->time_base.den *= 2;
|
||||||
}
|
}
|
||||||
} else if(!(os->oformat->flags & AVFMT_VARIABLE_FPS)) {
|
} else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS)) {
|
||||||
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
||||||
codec->time_base = icodec->time_base;
|
codec->time_base = icodec->time_base;
|
||||||
codec->time_base.num *= icodec->ticks_per_frame;
|
codec->time_base.num *= icodec->ticks_per_frame;
|
||||||
@@ -2196,8 +2198,10 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
} else {
|
} else {
|
||||||
if (!ost->enc)
|
if (!ost->enc)
|
||||||
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
||||||
|
|
||||||
ist->decoding_needed = 1;
|
ist->decoding_needed = 1;
|
||||||
ost->encoding_needed = 1;
|
ost->encoding_needed = 1;
|
||||||
|
|
||||||
switch(codec->codec_type) {
|
switch(codec->codec_type) {
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
ost->fifo = av_fifo_alloc(1024);
|
ost->fifo = av_fifo_alloc(1024);
|
||||||
@@ -2208,9 +2212,11 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
codec->sample_rate = icodec->sample_rate;
|
codec->sample_rate = icodec->sample_rate;
|
||||||
choose_sample_rate(ost->st, ost->enc);
|
choose_sample_rate(ost->st, ost->enc);
|
||||||
codec->time_base = (AVRational){1, codec->sample_rate};
|
codec->time_base = (AVRational){1, codec->sample_rate};
|
||||||
|
|
||||||
if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
|
if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
|
||||||
codec->sample_fmt = icodec->sample_fmt;
|
codec->sample_fmt = icodec->sample_fmt;
|
||||||
choose_sample_fmt(ost->st, ost->enc);
|
choose_sample_fmt(ost->st, ost->enc);
|
||||||
|
|
||||||
if (ost->audio_channels_mapped) {
|
if (ost->audio_channels_mapped) {
|
||||||
/* the requested output channel is set to the number of
|
/* the requested output channel is set to the number of
|
||||||
* -map_channel only if no -ac are specified */
|
* -map_channel only if no -ac are specified */
|
||||||
@@ -2233,6 +2239,7 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
}
|
}
|
||||||
if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
|
if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
|
||||||
codec->channel_layout = 0;
|
codec->channel_layout = 0;
|
||||||
|
|
||||||
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
||||||
ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt
|
ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt
|
||||||
|| codec->channel_layout != icodec->channel_layout;
|
|| codec->channel_layout != icodec->channel_layout;
|
||||||
@@ -2275,8 +2282,8 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
}
|
}
|
||||||
codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num};
|
codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num};
|
||||||
if( av_q2d(codec->time_base) < 0.001 && video_sync_method
|
if( av_q2d(codec->time_base) < 0.001 && video_sync_method
|
||||||
&& (video_sync_method==1 || (video_sync_method<0 && !(os->oformat->flags & AVFMT_VARIABLE_FPS)))){
|
&& (video_sync_method==1 || (video_sync_method<0 && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){
|
||||||
av_log(os, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n"
|
av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n"
|
||||||
"Please consider specifiying a lower framerate, a different muxer or -vsync 2\n");
|
"Please consider specifiying a lower framerate, a different muxer or -vsync 2\n");
|
||||||
}
|
}
|
||||||
for (j = 0; j < ost->forced_kf_count; j++)
|
for (j = 0; j < ost->forced_kf_count; j++)
|
||||||
@@ -2404,15 +2411,15 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
|
|
||||||
/* open files and write file headers */
|
/* open files and write file headers */
|
||||||
for (i = 0; i < nb_output_files; i++) {
|
for (i = 0; i < nb_output_files; i++) {
|
||||||
os = output_files[i].ctx;
|
oc = output_files[i].ctx;
|
||||||
os->interrupt_callback = int_cb;
|
oc->interrupt_callback = int_cb;
|
||||||
if (avformat_write_header(os, &output_files[i].opts) < 0) {
|
if (avformat_write_header(oc, &output_files[i].opts) < 0) {
|
||||||
snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
|
snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto dump_format;
|
goto dump_format;
|
||||||
}
|
}
|
||||||
// assert_avoptions(output_files[i].opts);
|
// assert_avoptions(output_files[i].opts);
|
||||||
if (strcmp(os->oformat->name, "rtp")) {
|
if (strcmp(oc->oformat->name, "rtp")) {
|
||||||
want_sdp = 0;
|
want_sdp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -724,6 +724,11 @@ static int frame_thread_init(AVCodecContext *avctx)
|
|||||||
p->parent = fctx;
|
p->parent = fctx;
|
||||||
p->avctx = copy;
|
p->avctx = copy;
|
||||||
|
|
||||||
|
if (!copy) {
|
||||||
|
err = AVERROR(ENOMEM);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
*copy = *src;
|
*copy = *src;
|
||||||
copy->thread_opaque = p;
|
copy->thread_opaque = p;
|
||||||
copy->pkt = &p->avpkt;
|
copy->pkt = &p->avpkt;
|
||||||
@@ -737,6 +742,10 @@ static int frame_thread_init(AVCodecContext *avctx)
|
|||||||
update_context_from_thread(avctx, copy, 1);
|
update_context_from_thread(avctx, copy, 1);
|
||||||
} else {
|
} else {
|
||||||
copy->priv_data = av_malloc(codec->priv_data_size);
|
copy->priv_data = av_malloc(codec->priv_data_size);
|
||||||
|
if (!copy->priv_data) {
|
||||||
|
err = AVERROR(ENOMEM);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
memcpy(copy->priv_data, src->priv_data, codec->priv_data_size);
|
memcpy(copy->priv_data, src->priv_data, codec->priv_data_size);
|
||||||
copy->internal = av_malloc(sizeof(AVCodecInternal));
|
copy->internal = av_malloc(sizeof(AVCodecInternal));
|
||||||
if (!copy->internal) {
|
if (!copy->internal) {
|
||||||
|
Reference in New Issue
Block a user