mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avformat/utils: Inject global side data into first packet.
This fixes replaygain handling in ffplay and probably other applications. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
a31547ce2e
commit
289f02f923
@ -1040,6 +1040,11 @@ typedef struct AVStream {
|
|||||||
uint8_t dts_ordered;
|
uint8_t dts_ordered;
|
||||||
uint8_t dts_misordered;
|
uint8_t dts_misordered;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal data to inject global side data
|
||||||
|
*/
|
||||||
|
int global_side_data_injected;
|
||||||
|
|
||||||
} AVStream;
|
} AVStream;
|
||||||
|
|
||||||
AVRational av_stream_get_r_frame_rate(const AVStream *s);
|
AVRational av_stream_get_r_frame_rate(const AVStream *s);
|
||||||
|
@ -1526,6 +1526,25 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
|
|||||||
}
|
}
|
||||||
st->skip_samples = 0;
|
st->skip_samples = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!st->global_side_data_injected) {
|
||||||
|
for (i = 0; i < st->nb_side_data; i++) {
|
||||||
|
AVPacketSideData *src_sd = &st->side_data[i];
|
||||||
|
uint8_t *dst_data;
|
||||||
|
|
||||||
|
if (av_packet_get_side_data(pkt, src_sd->type, NULL))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dst_data = av_packet_new_side_data(pkt, src_sd->type, src_sd->size);
|
||||||
|
if (!dst_data) {
|
||||||
|
av_log(s, AV_LOG_WARNING, "Couldnt inject global side data\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(dst_data, src_sd->data, src_sd->size);
|
||||||
|
}
|
||||||
|
st->global_side_data_injected = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret >= 0 && !(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
|
if (ret >= 0 && !(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
|
||||||
|
Loading…
Reference in New Issue
Block a user