mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-20 07:35:25 +08:00
fftools/ffmpeg: move some stream initialization code to ffmpeg_mux
The code in question is muxing-specific and so belongs there. This will allow make some objects private to the muxer in future commits.
This commit is contained in:
@@ -3115,7 +3115,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
|||||||
static int init_output_stream(OutputStream *ost, AVFrame *frame,
|
static int init_output_stream(OutputStream *ost, AVFrame *frame,
|
||||||
char *error, int error_len)
|
char *error, int error_len)
|
||||||
{
|
{
|
||||||
OutputFile *of = output_files[ost->file_index];
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ost->enc_ctx) {
|
if (ost->enc_ctx) {
|
||||||
@@ -3220,12 +3219,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (ost->sq_idx_mux >= 0)
|
ret = of_stream_init(output_files[ost->file_index], ost);
|
||||||
sq_set_tb(of->sq_mux, ost->sq_idx_mux, ost->mux_timebase);
|
|
||||||
|
|
||||||
ost->initialized = 1;
|
|
||||||
|
|
||||||
ret = of_check_init(output_files[ost->file_index]);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@@ -720,8 +720,14 @@ int hwaccel_decode_init(AVCodecContext *avctx);
|
|||||||
int of_muxer_init(OutputFile *of, AVFormatContext *fc,
|
int of_muxer_init(OutputFile *of, AVFormatContext *fc,
|
||||||
AVDictionary *opts, int64_t limit_filesize,
|
AVDictionary *opts, int64_t limit_filesize,
|
||||||
int thread_queue_size);
|
int thread_queue_size);
|
||||||
/* open the muxer when all the streams are initialized */
|
|
||||||
int of_check_init(OutputFile *of);
|
/*
|
||||||
|
* Initialize muxing state for the given stream, should be called
|
||||||
|
* after the codec/streamcopy setup has been done.
|
||||||
|
*
|
||||||
|
* Open the muxer once all the streams have been initialized.
|
||||||
|
*/
|
||||||
|
int of_stream_init(OutputFile *of, OutputStream *ost);
|
||||||
int of_write_trailer(OutputFile *of);
|
int of_write_trailer(OutputFile *of);
|
||||||
void of_close(OutputFile **pof);
|
void of_close(OutputFile **pof);
|
||||||
|
|
||||||
|
@@ -516,8 +516,7 @@ fail:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open the muxer when all the streams are initialized */
|
static int mux_check_init(OutputFile *of)
|
||||||
int of_check_init(OutputFile *of)
|
|
||||||
{
|
{
|
||||||
AVFormatContext *fc = of->mux->fc;
|
AVFormatContext *fc = of->mux->fc;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
@@ -565,6 +564,16 @@ int of_check_init(OutputFile *of)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int of_stream_init(OutputFile *of, OutputStream *ost)
|
||||||
|
{
|
||||||
|
if (ost->sq_idx_mux >= 0)
|
||||||
|
sq_set_tb(of->sq_mux, ost->sq_idx_mux, ost->mux_timebase);
|
||||||
|
|
||||||
|
ost->initialized = 1;
|
||||||
|
|
||||||
|
return mux_check_init(of);
|
||||||
|
}
|
||||||
|
|
||||||
int of_write_trailer(OutputFile *of)
|
int of_write_trailer(OutputFile *of)
|
||||||
{
|
{
|
||||||
AVFormatContext *fc = of->mux->fc;
|
AVFormatContext *fc = of->mux->fc;
|
||||||
@@ -710,7 +719,7 @@ int of_muxer_init(OutputFile *of, AVFormatContext *fc,
|
|||||||
|
|
||||||
/* write the header for files with no streams */
|
/* write the header for files with no streams */
|
||||||
if (of->format->flags & AVFMT_NOSTREAMS && fc->nb_streams == 0) {
|
if (of->format->flags & AVFMT_NOSTREAMS && fc->nb_streams == 0) {
|
||||||
ret = of_check_init(of);
|
ret = mux_check_init(of);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user