/* * Copyright (c) 2019 James Almer <jamrial@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** * @file * This bitstream filter splits AV1 Temporal Units into packets containing * just one frame, plus any leading and trailing OBUs that may be present at * the beginning or end, respectively. * * Temporal Units already containing only one frame will be passed through * unchanged. When splitting can't be performed, the Temporal Unit will be * passed through containing only the remaining OBUs starting from the first * one after the last successfully split frame.
*/
// split here unless it's the last frame, in which case // include every trailing OBU if (s->cur_frame < s->nb_frames) break;
} elseif (unit->type == AV1_OBU_FRAME_HEADER) {
AV1RawOBU *obu = unit->content;
if (frame) {
av_log(ctx, AV_LOG_WARNING, "Frame Header OBU found when Tile data for a " "previous frame was expected.\n"); goto passthrough;
}
// split here if show_existing_frame unless it's the last // frame, in which case include every trailing OBU if (frame->show_existing_frame &&
s->cur_frame < s->nb_frames) {
s->cur_frame_idx = i + 1; break;
}
} elseif (unit->type == AV1_OBU_TILE_GROUP) {
AV1RawOBU *obu = unit->content;
AV1RawTileGroup *group = &obu->obu.tile_group;
if (!frame || cur_frame_type != AV1_OBU_FRAME_HEADER) {
av_log(ctx, AV_LOG_WARNING, "Unexpected Tile Group OBU found before a " "Frame Header.\n"); goto passthrough;
}
if ((group->tg_end == (frame->tile_cols * frame->tile_rows) - 1) && // include every trailing OBU with the last frame
s->cur_frame < s->nb_frames) {
s->cur_frame_idx = i + 1; break;
}
}
}
av_assert0(frame && s->cur_frame <= s->nb_frames);
ret = av_packet_ref(out, s->buffer_pkt); if (ret < 0) goto fail;
// skip the frame in the buffer packet if it's split successfully, so it's not present // if the packet is passed through in case of failure when splitting another frame.
s->buffer_pkt->data += size;
s->buffer_pkt->size -= size;
if (!frame->show_existing_frame && !frame->show_frame)
out->pts = AV_NOPTS_VALUE;
if (s->cur_frame == s->nb_frames) {
av_packet_unref(s->buffer_pkt);
ff_cbs_fragment_reset(td);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.