mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 04:26:37 +08: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:
		| @@ -22,6 +22,7 @@ | |||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| typedef struct AAXColumn { | typedef struct AAXColumn { | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|  |  | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "rawdec.h" | #include "rawdec.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ | |||||||
|  |  | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| #define BLOCK_SIZE    18 | #define BLOCK_SIZE    18 | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ | |||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| #include "pcm.h" | #include "pcm.h" | ||||||
| #include "aiff.h" | #include "aiff.h" | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|  |  | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| static int aix_probe(const AVProbeData *p) | static int aix_probe(const AVProbeData *p) | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ | |||||||
|  |  | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| typedef struct Page { | typedef struct Page { | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ | |||||||
|  |  | ||||||
| #include "libavutil/channel_layout.h" | #include "libavutil/channel_layout.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
| #include "internal.h" | #include "demux.h" | ||||||
|  |  | ||||||
| static int apc_probe(const AVProbeData *p) | static int apc_probe(const AVProbeData *p) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ | |||||||
| #include "libavutil/channel_layout.h" | #include "libavutil/channel_layout.h" | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| typedef struct BFIContext { | typedef struct BFIContext { | ||||||
|   | |||||||
| @@ -33,6 +33,7 @@ | |||||||
| #include "libavutil/channel_layout.h" | #include "libavutil/channel_layout.h" | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| enum BinkAudFlags { | enum BinkAudFlags { | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ | |||||||
| #include <inttypes.h> | #include <inttypes.h> | ||||||
|  |  | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| #include "isom.h" | #include "isom.h" | ||||||
| #include "mov_chan.h" | #include "mov_chan.h" | ||||||
|   | |||||||
| @@ -217,4 +217,13 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels, | |||||||
|  */ |  */ | ||||||
| int ff_generate_avci_extradata(AVStream *st); | 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 */ | #endif /* AVFORMAT_DEMUX_H */ | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ | |||||||
| #include "libavcodec/bytestream.h" | #include "libavcodec/bytestream.h" | ||||||
| #include "libavcodec/packet_internal.h" | #include "libavcodec/packet_internal.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "avio_internal.h" | ||||||
| #include "demux.h" | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| @@ -350,3 +351,19 @@ int ff_generate_avci_extradata(AVStream *st) | |||||||
|  |  | ||||||
|     return 0; |     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; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -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); | 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 |  * Copies the whilelists from one context to the other | ||||||
|  */ |  */ | ||||||
|   | |||||||
| @@ -22,13 +22,12 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| #include "isom.h" | #include "isom.h" | ||||||
| #include "libavcodec/mpeg4audio.h" | #include "libavcodec/mpeg4audio.h" | ||||||
| #include "libavcodec/mpegaudiodata.h" | #include "libavcodec/mpegaudiodata.h" | ||||||
| #include "libavutil/avstring.h" |  | ||||||
| #include "libavutil/channel_layout.h" | #include "libavutil/channel_layout.h" | ||||||
| #include "libavutil/intreadwrite.h" |  | ||||||
|  |  | ||||||
| /* http://www.mp4ra.org */ | /* http://www.mp4ra.org */ | ||||||
| /* ordered by muxing preference */ | /* ordered by muxing preference */ | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ | |||||||
| #include "libavutil/channel_layout.h" | #include "libavutil/channel_layout.h" | ||||||
|  |  | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| #include "apetag.h" | #include "apetag.h" | ||||||
| #include "id3v1.h" | #include "id3v1.h" | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ | |||||||
| #include "libavutil/intfloat.h" | #include "libavutil/intfloat.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| #include "riff.h" | #include "riff.h" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ | |||||||
| #include "libavutil/log.h" | #include "libavutil/log.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "riff.h" | #include "riff.h" | ||||||
|  |  | ||||||
| int ff_get_guid(AVIOContext *s, ff_asf_guid *g) | int ff_get_guid(AVIOContext *s, ff_asf_guid *g) | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ | |||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "libavutil/mathematics.h" | #include "libavutil/mathematics.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| #define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr, palette | #define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr, palette | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ | |||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
| #include "avio.h" | #include "avio.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| static const AVCodecTag rsd_tags[] = { | static const AVCodecTag rsd_tags[] = { | ||||||
|   | |||||||
| @@ -359,22 +359,6 @@ int ff_alloc_extradata(AVCodecParameters *par, int size) | |||||||
|     return 0; |     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) | AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s) | ||||||
| { | { | ||||||
|     for (unsigned i = 0; i < ic->nb_programs; i++) { |     for (unsigned i = 0; i < ic->nb_programs; i++) { | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ | |||||||
|  |  | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| #define VC1_EXTRADATA_SIZE 4 | #define VC1_EXTRADATA_SIZE 4 | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ | |||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| #define FORM_TAG MKBETAG('F', 'O', 'R', 'M') | #define FORM_TAG MKBETAG('F', 'O', 'R', 'M') | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ | |||||||
| #include "libavutil/channel_layout.h" | #include "libavutil/channel_layout.h" | ||||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||||
| #include "avformat.h" | #include "avformat.h" | ||||||
|  | #include "demux.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
|  |  | ||||||
| typedef struct yop_dec_context { | typedef struct yop_dec_context { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Andreas Rheinhardt
					Andreas Rheinhardt