mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-15 12:18:52 +00:00
feat(encoder): copy input streams' metadata to output streams (#1284)
* feat(encoder): copy language tag for audio and subtitle streams Containers with audio streams for different languages use a tag to signal which track contains which language. This information is saved in the metadata object of a stream and needs to be copied in addition to the codec properties. * feat(encoder): copy input streams' metadata to output streams --------- Signed-off-by: k4yt3x <i@k4yt3x.com> Co-authored-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
parent
b1190d7591
commit
8ffe1b84bd
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Multi-versioning to critical functions to enhance performance in generic architecture builds.
|
- Multi-versioning to critical functions to enhance performance in generic architecture builds.
|
||||||
|
- The feature to copy input streams' metadata to the output streams (#1282).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ int Encoder::init(
|
|||||||
return AVERROR_UNKNOWN;
|
return AVERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy codec parameters from input to output
|
// Copy codec parameters from the input stream to the output stream
|
||||||
ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
|
ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logger()->error("Failed to copy codec parameters");
|
logger()->error("Failed to copy codec parameters");
|
||||||
@ -233,6 +233,13 @@ int Encoder::init(
|
|||||||
}
|
}
|
||||||
out_stream->codecpar->codec_tag = 0;
|
out_stream->codecpar->codec_tag = 0;
|
||||||
|
|
||||||
|
// Copy all metadata from the input stream to the output stream
|
||||||
|
AVDictionaryEntry* tag = nullptr;
|
||||||
|
while ((tag = av_dict_get(in_stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)) !=
|
||||||
|
nullptr) {
|
||||||
|
av_dict_set(&out_stream->metadata, tag->key, tag->value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Copy time base
|
// Copy time base
|
||||||
out_stream->time_base = in_stream->time_base;
|
out_stream->time_base = in_stream->time_base;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user