avformat/movenc: add rtp_hinting_needed() helper function
This is shared test and this simplifies code a bit. Follow up commit will have additional tests for this function. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
94d831f388
commit
53688b62ca
@ -140,6 +140,13 @@ static int co64_required(const MOVTrack *track)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rtp_hinting_needed(const AVStream *st)
|
||||||
|
{
|
||||||
|
/* Add hint tracks for each audio and video stream */
|
||||||
|
return st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
|
||||||
|
st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
|
||||||
|
}
|
||||||
|
|
||||||
/* Chunk offset atom */
|
/* Chunk offset atom */
|
||||||
static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
|
static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
|
||||||
{
|
{
|
||||||
@ -5941,15 +5948,10 @@ static int mov_init(AVFormatContext *s)
|
|||||||
mov->chapter_track = mov->nb_streams++;
|
mov->chapter_track = mov->nb_streams++;
|
||||||
|
|
||||||
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
|
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
|
||||||
/* Add hint tracks for each audio and video stream */
|
for (i = 0; i < s->nb_streams; i++)
|
||||||
for (i = 0; i < s->nb_streams; i++) {
|
if (rtp_hinting_needed(s->streams[i]))
|
||||||
AVStream *st = s->streams[i];
|
|
||||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
|
|
||||||
st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
|
||||||
mov->nb_streams++;
|
mov->nb_streams++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4)
|
if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4)
|
||||||
|| mov->write_tmcd == 1) {
|
|| mov->write_tmcd == 1) {
|
||||||
@ -6171,16 +6173,11 @@ static int mov_write_header(AVFormatContext *s)
|
|||||||
nb_tracks++;
|
nb_tracks++;
|
||||||
|
|
||||||
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
|
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
|
||||||
/* Add hint tracks for each audio and video stream */
|
|
||||||
hint_track = nb_tracks;
|
hint_track = nb_tracks;
|
||||||
for (i = 0; i < s->nb_streams; i++) {
|
for (i = 0; i < s->nb_streams; i++)
|
||||||
AVStream *st = s->streams[i];
|
if (rtp_hinting_needed(s->streams[i]))
|
||||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
|
|
||||||
st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
|
||||||
nb_tracks++;
|
nb_tracks++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mov->mode == MODE_MOV || mov->mode == MODE_MP4)
|
if (mov->mode == MODE_MOV || mov->mode == MODE_MP4)
|
||||||
tmcd_track = nb_tracks;
|
tmcd_track = nb_tracks;
|
||||||
@ -6257,11 +6254,8 @@ static int mov_write_header(AVFormatContext *s)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
|
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
|
||||||
/* Initialize the hint tracks for each audio and video stream */
|
|
||||||
for (i = 0; i < s->nb_streams; i++) {
|
for (i = 0; i < s->nb_streams; i++) {
|
||||||
AVStream *st = s->streams[i];
|
if (rtp_hinting_needed(s->streams[i])) {
|
||||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
|
|
||||||
st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
|
||||||
if ((ret = ff_mov_init_hinting(s, hint_track, i)) < 0)
|
if ((ret = ff_mov_init_hinting(s, hint_track, i)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
hint_track++;
|
hint_track++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user