avformat/utils: Move avformat_queue_attached_pictures to demux_utils.c

AVStream.attached_pic is only used for demuxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-05-06 20:37:22 +02:00
parent d2da1dc443
commit 3c3c13e67b
2 changed files with 24 additions and 23 deletions

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavcodec/packet_internal.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
@ -83,3 +84,26 @@ void av_format_inject_global_side_data(AVFormatContext *s)
ffstream(st)->inject_global_side_data = 1;
}
}
int avformat_queue_attached_pictures(AVFormatContext *s)
{
FFFormatContext *const si = ffformatcontext(s);
int ret;
for (unsigned i = 0; i < s->nb_streams; i++)
if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
s->streams[i]->discard < AVDISCARD_ALL) {
if (s->streams[i]->attached_pic.size <= 0) {
av_log(s, AV_LOG_WARNING,
"Attached picture on stream %d has invalid size, "
"ignoring\n", i);
continue;
}
ret = avpriv_packet_list_put(&si->raw_packet_buffer,
&s->streams[i]->attached_pic,
av_packet_ref, 0);
if (ret < 0)
return ret;
}
return 0;
}

View File

@ -175,29 +175,6 @@ int av_filename_number_test(const char *filename)
(av_get_frame_filename(buf, sizeof(buf), filename, 1) >= 0);
}
int avformat_queue_attached_pictures(AVFormatContext *s)
{
FFFormatContext *const si = ffformatcontext(s);
int ret;
for (unsigned i = 0; i < s->nb_streams; i++)
if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
s->streams[i]->discard < AVDISCARD_ALL) {
if (s->streams[i]->attached_pic.size <= 0) {
av_log(s, AV_LOG_WARNING,
"Attached picture on stream %d has invalid size, "
"ignoring\n", i);
continue;
}
ret = avpriv_packet_list_put(&si->raw_packet_buffer,
&s->streams[i]->attached_pic,
av_packet_ref, 0);
if (ret < 0)
return ret;
}
return 0;
}
int ff_add_attached_pic(AVFormatContext *s, AVStream *st0, AVIOContext *pb,
AVBufferRef **buf, int size)
{