Commit 3d813e4c authored by Anton Khirnov's avatar Anton Khirnov

lavf: deprecate AVStream.stream_copy

It's only used in avconv, so it properly belongs to OutputStream struct
there.
parent 1b648c7c
...@@ -227,6 +227,7 @@ typedef struct OutputStream { ...@@ -227,6 +227,7 @@ typedef struct OutputStream {
int64_t sws_flags; int64_t sws_flags;
AVDictionary *opts; AVDictionary *opts;
int is_past_recording_time; int is_past_recording_time;
int stream_copy;
} OutputStream; } OutputStream;
...@@ -1346,7 +1347,7 @@ static void print_report(OutputFile *output_files, ...@@ -1346,7 +1347,7 @@ static void print_report(OutputFile *output_files,
float q = -1; float q = -1;
ost = &ost_table[i]; ost = &ost_table[i];
enc = ost->st->codec; enc = ost->st->codec;
if (!ost->st->stream_copy && enc->coded_frame) if (!ost->stream_copy && enc->coded_frame)
q = enc->coded_frame->quality/(float)FF_QP2LAMBDA; q = enc->coded_frame->quality/(float)FF_QP2LAMBDA;
if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
...@@ -1987,7 +1988,7 @@ static int transcode_init(OutputFile *output_files, ...@@ -1987,7 +1988,7 @@ static int transcode_init(OutputFile *output_files,
codec->bits_per_raw_sample= icodec->bits_per_raw_sample; codec->bits_per_raw_sample= icodec->bits_per_raw_sample;
codec->chroma_sample_location = icodec->chroma_sample_location; codec->chroma_sample_location = icodec->chroma_sample_location;
if (ost->st->stream_copy) { if (ost->stream_copy) {
uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE; uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
if (extra_size > INT_MAX) { if (extra_size > INT_MAX) {
...@@ -2297,7 +2298,7 @@ static int transcode_init(OutputFile *output_files, ...@@ -2297,7 +2298,7 @@ static int transcode_init(OutputFile *output_files,
av_log(NULL, AV_LOG_INFO, " [sync #%d.%d]", av_log(NULL, AV_LOG_INFO, " [sync #%d.%d]",
ost->sync_ist->file_index, ost->sync_ist->file_index,
ost->sync_ist->st->index); ost->sync_ist->st->index);
if (ost->st->stream_copy) if (ost->stream_copy)
av_log(NULL, AV_LOG_INFO, " (copy)"); av_log(NULL, AV_LOG_INFO, " (copy)");
else else
av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index].dec ? av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index].dec ?
...@@ -2525,7 +2526,7 @@ static int transcode(OutputFile *output_files, ...@@ -2525,7 +2526,7 @@ static int transcode(OutputFile *output_files,
for (i = 0; i < nb_output_streams; i++) { for (i = 0; i < nb_output_streams; i++) {
ost = &output_streams[i]; ost = &output_streams[i];
if (ost) { if (ost) {
if (ost->st->stream_copy) if (ost->stream_copy)
av_freep(&ost->st->codec->extradata); av_freep(&ost->st->codec->extradata);
if (ost->logfile) { if (ost->logfile) {
fclose(ost->logfile); fclose(ost->logfile);
...@@ -3009,7 +3010,7 @@ static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream * ...@@ -3009,7 +3010,7 @@ static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *
NULL, ost->st->codec->codec_type); NULL, ost->st->codec->codec_type);
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
} else if (!strcmp(codec_name, "copy")) } else if (!strcmp(codec_name, "copy"))
ost->st->stream_copy = 1; ost->stream_copy = 1;
else { else {
ost->enc = find_codec_or_die(codec_name, ost->st->codec->codec_type, 1); ost->enc = find_codec_or_die(codec_name, ost->st->codec->codec_type, 1);
ost->st->codec->codec_id = ost->enc->id; ost->st->codec->codec_id = ost->enc->id;
...@@ -3144,7 +3145,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) ...@@ -3144,7 +3145,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
st = ost->st; st = ost->st;
video_enc = st->codec; video_enc = st->codec;
if (!st->stream_copy) { if (!ost->stream_copy) {
const char *p = NULL; const char *p = NULL;
char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL; char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL;
char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL; char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
...@@ -3261,7 +3262,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc) ...@@ -3261,7 +3262,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
audio_enc = st->codec; audio_enc = st->codec;
audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
if (!st->stream_copy) { if (!ost->stream_copy) {
char *sample_fmt = NULL; char *sample_fmt = NULL;
MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
...@@ -3281,12 +3282,10 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc) ...@@ -3281,12 +3282,10 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc) static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc)
{ {
AVStream *st;
OutputStream *ost; OutputStream *ost;
ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA); ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA);
st = ost->st; if (!ost->stream_copy) {
if (!st->stream_copy) {
av_log(NULL, AV_LOG_FATAL, "Data stream encoding not supported yet (only streamcopy)\n"); av_log(NULL, AV_LOG_FATAL, "Data stream encoding not supported yet (only streamcopy)\n");
exit_program(1); exit_program(1);
} }
...@@ -3297,7 +3296,7 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc) ...@@ -3297,7 +3296,7 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc)
static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc) static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc)
{ {
OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT); OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT);
ost->st->stream_copy = 1; ost->stream_copy = 1;
return ost; return ost;
} }
...@@ -3401,9 +3400,9 @@ static int read_avserver_streams(OptionsContext *o, AVFormatContext *s, const ch ...@@ -3401,9 +3400,9 @@ static int read_avserver_streams(OptionsContext *o, AVFormatContext *s, const ch
st->info = NULL; st->info = NULL;
avcodec_copy_context(st->codec, ic->streams[i]->codec); avcodec_copy_context(st->codec, ic->streams[i]->codec);
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !st->stream_copy) if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
choose_sample_fmt(st, codec); choose_sample_fmt(st, codec);
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !st->stream_copy) else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
choose_pixel_fmt(st, codec); choose_pixel_fmt(st, codec);
} }
......
...@@ -530,8 +530,10 @@ typedef struct AVStream { ...@@ -530,8 +530,10 @@ typedef struct AVStream {
*/ */
AVRational time_base; AVRational time_base;
int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
#if FF_API_STREAM_COPY
/* ffmpeg.c private use */ /* ffmpeg.c private use */
int stream_copy; /**< If set, just copy stream. */ attribute_deprecated int stream_copy; /**< If set, just copy stream. */
#endif
enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
#if FF_API_AVSTREAM_QUALITY #if FF_API_AVSTREAM_QUALITY
......
...@@ -101,5 +101,8 @@ ...@@ -101,5 +101,8 @@
#ifndef FF_API_PRELOAD #ifndef FF_API_PRELOAD
#define FF_API_PRELOAD (LIBAVFORMAT_VERSION_MAJOR < 54) #define FF_API_PRELOAD (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif #endif
#ifndef FF_API_STREAM_COPY
#define FF_API_STREAM_COPY (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#endif /* AVFORMAT_VERSION_H */ #endif /* AVFORMAT_VERSION_H */
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