1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avformat/utils: Move ff_get_extradata to demux_utils.c

It is only used by demuxers (although it is hypothetically
possible that some day e.g. a protocol might need it, but
that is unlikely given that they don't deal with AVCodecParameters).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-05-06 21:28:57 +02:00
parent aef16886dd
commit a085cfa654
23 changed files with 45 additions and 28 deletions

View File

@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
typedef struct AAXColumn {

View File

@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "rawdec.h"
#include "internal.h"

View File

@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#define BLOCK_SIZE 18

View File

@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "pcm.h"
#include "aiff.h"

View File

@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
static int aix_probe(const AVProbeData *p)

View File

@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
typedef struct Page {

View File

@ -23,7 +23,7 @@
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
#include "demux.h"
static int apc_probe(const AVProbeData *p)
{

View File

@ -29,6 +29,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
typedef struct BFIContext {

View File

@ -33,6 +33,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
enum BinkAudFlags {

View File

@ -28,6 +28,7 @@
#include <inttypes.h>
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "isom.h"
#include "mov_chan.h"

View File

@ -217,4 +217,13 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
*/
int ff_generate_avci_extradata(AVStream *st);
/**
* Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
* which is always set to 0 and fill it from pb.
*
* @param size size of extradata
* @return >= 0 if OK, AVERROR_xxx on error
*/
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size);
#endif /* AVFORMAT_DEMUX_H */

View File

@ -25,6 +25,7 @@
#include "libavcodec/bytestream.h"
#include "libavcodec/packet_internal.h"
#include "avformat.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
@ -350,3 +351,19 @@ int ff_generate_avci_extradata(AVStream *st)
return 0;
}
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
{
int ret = ff_alloc_extradata(par, size);
if (ret < 0)
return ret;
ret = ffio_read_size(pb, par->extradata, size);
if (ret < 0) {
av_freep(&par->extradata);
par->extradata_size = 0;
av_log(logctx, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size);
return ret;
}
return ret;
}

View File

@ -652,15 +652,6 @@ int ff_rename(const char *url_src, const char *url_dst, void *logctx);
*/
int ff_alloc_extradata(AVCodecParameters *par, int size);
/**
* Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
* which is always set to 0 and fill it from pb.
*
* @param size size of extradata
* @return >= 0 if OK, AVERROR_xxx on error
*/
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size);
/**
* Copies the whilelists from one context to the other
*/

View File

@ -22,13 +22,12 @@
*/
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "isom.h"
#include "libavcodec/mpeg4audio.h"
#include "libavcodec/mpegaudiodata.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
/* http://www.mp4ra.org */
/* ordered by muxing preference */

View File

@ -22,6 +22,7 @@
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "apetag.h"
#include "id3v1.h"

View File

@ -25,6 +25,7 @@
#include "libavutil/intfloat.h"
#include "avformat.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
#include "riff.h"

View File

@ -26,6 +26,7 @@
#include "libavutil/log.h"
#include "avformat.h"
#include "avio_internal.h"
#include "demux.h"
#include "riff.h"
int ff_get_guid(AVIOContext *s, ff_asf_guid *g)

View File

@ -37,6 +37,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr, palette

View File

@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "avio.h"
#include "demux.h"
#include "internal.h"
static const AVCodecTag rsd_tags[] = {

View File

@ -359,22 +359,6 @@ int ff_alloc_extradata(AVCodecParameters *par, int size)
return 0;
}
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
{
int ret = ff_alloc_extradata(par, size);
if (ret < 0)
return ret;
ret = ffio_read_size(pb, par->extradata, size);
if (ret < 0) {
av_freep(&par->extradata);
par->extradata_size = 0;
av_log(logctx, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size);
return ret;
}
return ret;
}
AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
{
for (unsigned i = 0; i < ic->nb_programs; i++) {

View File

@ -28,6 +28,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#define VC1_EXTRADATA_SIZE 4

View File

@ -32,6 +32,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
#define FORM_TAG MKBETAG('F', 'O', 'R', 'M')

View File

@ -25,6 +25,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
typedef struct yop_dec_context {