You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
avformat/movenc: Factor check_pkt() out
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit deabcd2c05
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@ -4296,15 +4296,10 @@ static int mov_auto_flush_fragment(AVFormatContext *s)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
static int check_pkt(AVFormatContext *s, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
MOVMuxContext *mov = s->priv_data;
|
MOVMuxContext *mov = s->priv_data;
|
||||||
AVIOContext *pb = s->pb;
|
|
||||||
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
||||||
AVCodecContext *enc = trk->enc;
|
|
||||||
unsigned int samples_in_chunk = 0;
|
|
||||||
int size = pkt->size, ret = 0;
|
|
||||||
uint8_t *reformatted_data = NULL;
|
|
||||||
|
|
||||||
if (trk->entry) {
|
if (trk->entry) {
|
||||||
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
|
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
|
||||||
@ -4321,6 +4316,23 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
{
|
||||||
|
MOVMuxContext *mov = s->priv_data;
|
||||||
|
AVIOContext *pb = s->pb;
|
||||||
|
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
||||||
|
AVCodecContext *enc = trk->enc;
|
||||||
|
unsigned int samples_in_chunk = 0;
|
||||||
|
int size = pkt->size, ret = 0;
|
||||||
|
uint8_t *reformatted_data = NULL;
|
||||||
|
|
||||||
|
ret = check_pkt(s, pkt);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
|
if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
|
||||||
int ret;
|
int ret;
|
||||||
if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
|
if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
|
||||||
|
Reference in New Issue
Block a user