1
0
Fork 0
forked from len0rd/rockbox

[BugFix] Enums are only 2 bytes on some Devices

using enums to hold values larger than 0xFFFF could be problematic

WIP

Change-Id: I3a9be957265364b545f022fe26163f0869569e3e
This commit is contained in:
William Wilgus 2024-11-24 08:44:18 -05:00 committed by William Wilgus
parent 9e2c85e076
commit 4ec34f6986
18 changed files with 168 additions and 165 deletions

View file

@ -29,14 +29,12 @@ CODEC_HEADER
((((uint32_t)c1)<<24)|(((uint32_t)c2)<<16)|(((uint32_t)c3)<<8)|((uint32_t)c4)) ((((uint32_t)c1)<<24)|(((uint32_t)c2)<<16)|(((uint32_t)c3)<<8)|((uint32_t)c4))
/* This codec supports the following AIFC compressionType formats */ /* This codec supports the following AIFC compressionType formats */
enum { #define AIFC_FORMAT_PCM FOURCC('N', 'O', 'N', 'E') /* AIFC PCM Format (big endian) */
AIFC_FORMAT_PCM = FOURCC('N', 'O', 'N', 'E'), /* AIFC PCM Format (big endian) */ #define AIFC_FORMAT_ALAW FOURCC('a', 'l', 'a', 'w') /* AIFC ALaw compressed */
AIFC_FORMAT_ALAW = FOURCC('a', 'l', 'a', 'w'), /* AIFC ALaw compressed */ #define AIFC_FORMAT_MULAW FOURCC('u', 'l', 'a', 'w') /* AIFC uLaw compressed */
AIFC_FORMAT_MULAW = FOURCC('u', 'l', 'a', 'w'), /* AIFC uLaw compressed */ #define AIFC_FORMAT_IEEE_FLOAT32 FOURCC('f', 'l', '3', '2') /* AIFC IEEE float 32 bit */
AIFC_FORMAT_IEEE_FLOAT32 = FOURCC('f', 'l', '3', '2'), /* AIFC IEEE float 32 bit */ #define AIFC_FORMAT_IEEE_FLOAT64 FOURCC('f', 'l', '6', '4') /* AIFC IEEE float 64 bit */
AIFC_FORMAT_IEEE_FLOAT64 = FOURCC('f', 'l', '6', '4'), /* AIFC IEEE float 64 bit */ #define AIFC_FORMAT_QT_IMA_ADPCM FOURCC('i', 'm', 'a', '4') /* AIFC QuickTime IMA ADPCM */
AIFC_FORMAT_QT_IMA_ADPCM = FOURCC('i', 'm', 'a', '4'), /* AIFC QuickTime IMA ADPCM */
};
static const struct pcm_entry pcm_codecs[] = { static const struct pcm_entry pcm_codecs[] = {
{ AIFC_FORMAT_PCM, get_linear_pcm_codec }, { AIFC_FORMAT_PCM, get_linear_pcm_codec },

View file

@ -31,7 +31,9 @@ cRSID_C64instance* cRSID_createC64 (cRSID_C64instance* C64, unsigned short sampl
void cRSID_setC64 (cRSID_C64instance* C64) { //set hardware-parameters (Models, SIDs) for playback of loaded SID-tune void cRSID_setC64 (cRSID_C64instance* C64) { //set hardware-parameters (Models, SIDs) for playback of loaded SID-tune
enum C64clocks { C64_PAL_CPUCLK=985248, C64_NTSC_CPUCLK=1022727 }; #define C64_PAL_CPUCLK (985248)
#define C64_NTSC_CPUCLK (1022727)
enum C64scanlines { C64_PAL_SCANLINES = 312, C64_NTSC_SCANLINES = 263 }; enum C64scanlines { C64_PAL_SCANLINES = 312, C64_NTSC_SCANLINES = 263 };
enum C64scanlineCycles { C64_PAL_SCANLINE_CYCLES = 63, C64_NTSC_SCANLINE_CYCLES = 65 }; enum C64scanlineCycles { C64_PAL_SCANLINE_CYCLES = 63, C64_NTSC_SCANLINE_CYCLES = 65 };
//enum C64framerates { PAL_FRAMERATE = 50, NTSC_FRAMERATE = 60 }; //Hz //enum C64framerates { PAL_FRAMERATE = 50, NTSC_FRAMERATE = 60 }; //Hz

View file

@ -104,7 +104,7 @@ char cRSID_playSIDfile(cRSID_C64instance* C64, char* filename, char subtune) {
cRSID_SIDheader* cRSID_loadSIDtune(cRSID_C64instance* C64, char* filename) { cRSID_SIDheader* cRSID_loadSIDtune(cRSID_C64instance* C64, char* filename) {
enum SIDspecs { CRSID_FILESIZE_MAX = 100000 }; #define CRSID_FILESIZE_MAX (100000)
int FileSize; int FileSize;
static unsigned char SIDfileData [CRSID_FILESIZE_MAX]; //use memset? static unsigned char SIDfileData [CRSID_FILESIZE_MAX]; //use memset?

View file

@ -102,10 +102,12 @@ enum codec_command_action {
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
CODEC_ACTION_STREAM_FINISH = 2, CODEC_ACTION_STREAM_FINISH = 2,
#endif #endif
CODEC_ACTION_MIN = LONG_MIN,
CODEC_ACTION_MAX = LONG_MAX,
}; };
#define CODEC_ACTION_MIN (LONG_MIN)
#define CODEC_ACTION_MAX = (LONG_MAX)
/* NOTE: To support backwards compatibility, only add new functions at /* NOTE: To support backwards compatibility, only add new functions at
the end of the structure. Every time you add a new function, the end of the structure. Every time you add a new function,
remember to increase CODEC_API_VERSION. If you make changes to the remember to increase CODEC_API_VERSION. If you make changes to the

View file

@ -14,7 +14,7 @@
// 64K memory to load code and data into before starting track. Caller // 64K memory to load code and data into before starting track. Caller
// must parse the AY file. // must parse the AY file.
enum { mem_size = 0x10000 }; #define mem_size (0x10000)
enum { ram_addr = 0x4000 }; // where official RAM starts enum { ram_addr = 0x4000 }; // where official RAM starts
// AY file header // AY file header

View file

@ -34,7 +34,7 @@ static int const blip_buffer_extra_ = BLIP_MAX_QUALITY + 2;
// Properties of fixed-point sample position // Properties of fixed-point sample position
typedef unsigned ufixed_t; // unsigned for more range, optimized shifts typedef unsigned ufixed_t; // unsigned for more range, optimized shifts
enum { fixed_bits = BLIP_BUFFER_ACCURACY }; // bits in fraction enum { fixed_bits = BLIP_BUFFER_ACCURACY }; // bits in fraction
enum { fixed_unit = 1 << fixed_bits }; // 1.0 samples #define fixed_unit (1 << fixed_bits) // 1.0 samples
// Deltas in buffer are fixed-point with this many fraction bits. // Deltas in buffer are fixed-point with this many fraction bits.
// Less than 16 for extra range. // Less than 16 for extra range.

View file

@ -7,7 +7,7 @@
#include "gb_oscs.h" #include "gb_oscs.h"
// Clock rate sound hardware runs at // Clock rate sound hardware runs at
enum { clock_rate = 4194304 * GB_APU_OVERCLOCK }; #define clock_rate (4194304 * GB_APU_OVERCLOCK)
// Registers are at io_addr to io_addr+io_size-1 // Registers are at io_addr to io_addr+io_size-1
enum { io_addr = 0xFF10 }; enum { io_addr = 0xFF10 };

View file

@ -11,7 +11,7 @@ typedef int addr_t;
// Emulator reads this many bytes past end of a page // Emulator reads this many bytes past end of a page
enum { cpu_padding = 8 }; enum { cpu_padding = 8 };
enum { mem_size = 0x10000 }; #define mem_size (0x10000)
enum { page_bits = 13 }; enum { page_bits = 13 };
enum { page_size = 1 << page_bits }; enum { page_size = 1 << page_bits };
enum { page_count = mem_size >> page_bits }; enum { page_count = mem_size >> page_bits };

View file

@ -98,7 +98,7 @@ static inline void Sweep_reset( struct Gb_Square* this )
// Noise // Noise
enum { period2_mask = 0x1FFFF }; #define period2_mask (0x1FFFF)
struct Gb_Noise { struct Gb_Noise {
struct Gb_Osc osc; struct Gb_Osc osc;

View file

@ -34,7 +34,7 @@ enum {
enum { idle_addr = 0xFFFF }; enum { idle_addr = 0xFFFF };
enum { scc_enabled_true = 0xC000 }; enum { scc_enabled_true = 0xC000 };
enum { mem_size = 0x10000 }; #define mem_size (0x10000)
// KSS file header // KSS file header
enum { header_size = 0x20 }; enum { header_size = 0x20 };

View file

@ -9,7 +9,7 @@
enum { apu_status_addr = 0x4015 }; enum { apu_status_addr = 0x4015 };
enum { apu_osc_count = 5 }; enum { apu_osc_count = 5 };
enum { apu_no_irq = INT_MAX/2 + 1 }; #define apu_no_irq (INT_MAX/2 + 1)
enum { apu_irq_waiting = 0 }; enum { apu_irq_waiting = 0 };
enum { apu_io_addr = 0x4000 }; enum { apu_io_addr = 0x4000 };

View file

@ -11,13 +11,13 @@ typedef int nes_time_t;
typedef int addr_t; typedef int addr_t;
enum { page_bits = 11 }; enum { page_bits = 11 };
enum { page_size = 1 << page_bits }; #define page_size (1 << page_bits)
enum { page_count = 0x10000 >> page_bits }; enum { page_count = 0x10000 >> page_bits };
// Unmapped page should be filled with this // Unmapped page should be filled with this
enum { halt_opcode = 0x22 }; enum { halt_opcode = 0x22 };
enum { future_time = INT_MAX/2 + 1 }; #define future_time (INT_MAX/2 + 1)
enum { irq_inhibit_mask = 0x04 }; enum { irq_inhibit_mask = 0x04 };
// Can read this many bytes past end of a page // Can read this many bytes past end of a page

View file

@ -38,7 +38,7 @@ enum { bank_count = fds_banks + 8 };
enum { rom_begin = 0x8000 }; enum { rom_begin = 0x8000 };
enum { bank_select_addr = 0x5FF8 }; enum { bank_select_addr = 0x5FF8 };
enum { mem_size = 0x10000 }; #define mem_size (0x10000)
// cpu sits here when waiting for next call to play routine // cpu sits here when waiting for next call to play routine
enum { idle_addr = 0x5FF6 }; enum { idle_addr = 0x5FF6 };

View file

@ -10,7 +10,7 @@
typedef short sample_t; typedef short sample_t;
typedef int sample_count_t; typedef int sample_count_t;
enum { indefinite_count = INT_MAX/2 + 1 }; #define indefinite_count (INT_MAX/2 + 1)
enum { buf_size = 2048 }; enum { buf_size = 2048 };
struct setup_t { struct setup_t {

View file

@ -278,7 +278,7 @@ struct cache_entry_t
uint8_t block_header; /* final wave block header */ uint8_t block_header; /* final wave block header */
}; };
enum { BRR_CACHE_SIZE = 0x20000 + 32}; #define BRR_CACHE_SIZE (0x20000 + 32)
struct voice_wave_t struct voice_wave_t
{ {
@ -424,7 +424,7 @@ struct Spc_Emu
uint8_t boot_rom [ROM_SIZE]; uint8_t boot_rom [ROM_SIZE];
}; };
enum { SPC_FILE_SIZE = 0x10180 }; #define SPC_FILE_SIZE (0x10180)
struct spc_file_t struct spc_file_t
{ {

View file

@ -213,149 +213,150 @@ enum CodecID {
CODEC_ID_VP8, CODEC_ID_VP8,
CODEC_ID_PICTOR, CODEC_ID_PICTOR,
CODEC_ID_ANSI, CODEC_ID_ANSI,
};
/* enums are 2 bits on some devices */
/* various PCM "codecs" */ /* various PCM "codecs" */
CODEC_ID_PCM_S16LE= 0x10000, #define CODEC_ID_PCM_S16LE (0x10000)
CODEC_ID_PCM_S16BE, #define CODEC_ID_PCM_S16BE (0x10001)
CODEC_ID_PCM_U16LE, #define CODEC_ID_PCM_U16LE (0x10002)
CODEC_ID_PCM_U16BE, #define CODEC_ID_PCM_U16BE (0x10003)
CODEC_ID_PCM_S8, #define CODEC_ID_PCM_S8 (0x10004)
CODEC_ID_PCM_U8, #define CODEC_ID_PCM_U8 (0x10005)
CODEC_ID_PCM_MULAW, #define CODEC_ID_PCM_MULAW (0x10006)
CODEC_ID_PCM_ALAW, #define CODEC_ID_PCM_ALAW (0x10007)
CODEC_ID_PCM_S32LE, #define CODEC_ID_PCM_S32LE (0x10008)
CODEC_ID_PCM_S32BE, #define CODEC_ID_PCM_S32BE (0x10009)
CODEC_ID_PCM_U32LE, #define CODEC_ID_PCM_U32LE (0x1000A)
CODEC_ID_PCM_U32BE, #define CODEC_ID_PCM_U32BE (0x1000B)
CODEC_ID_PCM_S24LE, #define CODEC_ID_PCM_S24LE (0x1000C)
CODEC_ID_PCM_S24BE, #define CODEC_ID_PCM_S24BE (0x1000D)
CODEC_ID_PCM_U24LE, #define CODEC_ID_PCM_U24LE (0x1000E)
CODEC_ID_PCM_U24BE, #define CODEC_ID_PCM_U24BE (0x1000F)
CODEC_ID_PCM_S24DAUD, #define CODEC_ID_PCM_S24DAUD (0x10010)
CODEC_ID_PCM_ZORK, #define CODEC_ID_PCM_ZORK (0x10011)
CODEC_ID_PCM_S16LE_PLANAR, #define CODEC_ID_PCM_S16LE_PLANAR (0x10012)
CODEC_ID_PCM_DVD, #define CODEC_ID_PCM_DVD (0x10013)
CODEC_ID_PCM_F32BE, #define CODEC_ID_PCM_F32BE (0x10014)
CODEC_ID_PCM_F32LE, #define CODEC_ID_PCM_F32LE (0x10015)
CODEC_ID_PCM_F64BE, #define CODEC_ID_PCM_F64BE (0x10016)
CODEC_ID_PCM_F64LE, #define CODEC_ID_PCM_F64LE (0x10017)
CODEC_ID_PCM_BLURAY, #define CODEC_ID_PCM_BLURAY (0x10018)
/* various ADPCM codecs */ /* various ADPCM codecs */
CODEC_ID_ADPCM_IMA_QT= 0x11000, #define CODEC_ID_ADPCM_IMA_QT (0x11000)
CODEC_ID_ADPCM_IMA_WAV, #define CODEC_ID_ADPCM_IMA_WAV (0x11001)
CODEC_ID_ADPCM_IMA_DK3, #define CODEC_ID_ADPCM_IMA_DK3 (0x11002)
CODEC_ID_ADPCM_IMA_DK4, #define CODEC_ID_ADPCM_IMA_DK4 (0x11003)
CODEC_ID_ADPCM_IMA_WS, #define CODEC_ID_ADPCM_IMA_WS (0x11004)
CODEC_ID_ADPCM_IMA_SMJPEG, #define CODEC_ID_ADPCM_IMA_SMJPEG (0x11005)
CODEC_ID_ADPCM_MS, #define CODEC_ID_ADPCM_MS (0x11006)
CODEC_ID_ADPCM_4XM, #define CODEC_ID_ADPCM_4XM (0x11007)
CODEC_ID_ADPCM_XA, #define CODEC_ID_ADPCM_XA (0x11008)
CODEC_ID_ADPCM_ADX, #define CODEC_ID_ADPCM_ADX (0x11009)
CODEC_ID_ADPCM_EA, #define CODEC_ID_ADPCM_EA (0x1100A)
CODEC_ID_ADPCM_G726, #define CODEC_ID_ADPCM_G726 (0x1100B)
CODEC_ID_ADPCM_CT, #define CODEC_ID_ADPCM_CT (0x1100C)
CODEC_ID_ADPCM_SWF, #define CODEC_ID_ADPCM_SWF (0x1100D)
CODEC_ID_ADPCM_YAMAHA, #define CODEC_ID_ADPCM_YAMAHA (0x1100E)
CODEC_ID_ADPCM_SBPRO_4, #define CODEC_ID_ADPCM_SBPRO_4 (0x1100F)
CODEC_ID_ADPCM_SBPRO_3, #define CODEC_ID_ADPCM_SBPRO_3 (0x11010)
CODEC_ID_ADPCM_SBPRO_2, #define CODEC_ID_ADPCM_SBPRO_2 (0x11011)
CODEC_ID_ADPCM_THP, #define CODEC_ID_ADPCM_THP (0x11012)
CODEC_ID_ADPCM_IMA_AMV, #define CODEC_ID_ADPCM_IMA_AMV (0x11013)
CODEC_ID_ADPCM_EA_R1, #define CODEC_ID_ADPCM_EA_R1 (0x11014)
CODEC_ID_ADPCM_EA_R3, #define CODEC_ID_ADPCM_EA_R3 (0x11015)
CODEC_ID_ADPCM_EA_R2, #define CODEC_ID_ADPCM_EA_R2 (0x11016)
CODEC_ID_ADPCM_IMA_EA_SEAD, #define CODEC_ID_ADPCM_IMA_EA_SEAD (0x11017)
CODEC_ID_ADPCM_IMA_EA_EACS, #define CODEC_ID_ADPCM_IMA_EA_EACS (0x11018)
CODEC_ID_ADPCM_EA_XAS, #define CODEC_ID_ADPCM_EA_XAS (0x11019)
CODEC_ID_ADPCM_EA_MAXIS_XA, #define CODEC_ID_ADPCM_EA_MAXIS_XA (0x1101A)
CODEC_ID_ADPCM_IMA_ISS, #define CODEC_ID_ADPCM_IMA_ISS (0x1101B)
/* AMR */ /* AMR */
CODEC_ID_AMR_NB= 0x12000, #define CODEC_ID_AMR_NB (0x12000)
CODEC_ID_AMR_WB, #define CODEC_ID_AMR_WB (0x12001)
/* RealAudio codecs*/ /* RealAudio codecs*/
CODEC_ID_RA_144= 0x13000, #define CODEC_ID_RA_144 (0x13000)
CODEC_ID_RA_288, #define CODEC_ID_RA_288 (0x13001)
/* various DPCM codecs */ /* various DPCM codecs */
CODEC_ID_ROQ_DPCM= 0x14000, #define CODEC_ID_ROQ_DPCM (0x14000)
CODEC_ID_INTERPLAY_DPCM, #define CODEC_ID_INTERPLAY_DPCM (0x14001)
CODEC_ID_XAN_DPCM, #define CODEC_ID_XAN_DPCM (0x14002)
CODEC_ID_SOL_DPCM, #define CODEC_ID_SOL_DPCM (0x14003)
/* audio codecs */ /* audio codecs */
CODEC_ID_MP2= 0x15000, #define CODEC_ID_MP2 (0x15000)
CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 #define CODEC_ID_MP3 (0x15001) ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
CODEC_ID_AAC, #define CODEC_ID_AAC (0x15002)
CODEC_ID_AC3, #define CODEC_ID_AC3 (0x15003)
CODEC_ID_DTS, #define CODEC_ID_DTS (0x15004)
CODEC_ID_VORBIS, #define CODEC_ID_VORBIS (0x15005)
CODEC_ID_DVAUDIO, #define CODEC_ID_DVAUDIO (0x15006)
CODEC_ID_WMAV1, #define CODEC_ID_WMAV1 (0x15007)
CODEC_ID_WMAV2, #define CODEC_ID_WMAV2 (0x15008)
CODEC_ID_MACE3, #define CODEC_ID_MACE3 (0x15009)
CODEC_ID_MACE6, #define CODEC_ID_MACE6 (0x1500A)
CODEC_ID_VMDAUDIO, #define CODEC_ID_VMDAUDIO (0x1500B)
CODEC_ID_SONIC, #define CODEC_ID_SONIC (0x1500C)
CODEC_ID_SONIC_LS, #define CODEC_ID_SONIC_LS (0x1500D)
CODEC_ID_FLAC, #define CODEC_ID_FLAC (0x1500E)
CODEC_ID_MP3ADU, #define CODEC_ID_MP3ADU (0x1500F)
CODEC_ID_MP3ON4, #define CODEC_ID_MP3ON4 (0x15010)
CODEC_ID_SHORTEN, #define CODEC_ID_SHORTEN (0x15011)
CODEC_ID_ALAC, #define CODEC_ID_ALAC (0x15012)
CODEC_ID_WESTWOOD_SND1, #define CODEC_ID_WESTWOOD_SND1 (0x15013)
CODEC_ID_GSM, ///< as in Berlin toast format #define CODEC_ID_GSM (0x15014) ///< as in Berlin toast format
CODEC_ID_QDM2, #define CODEC_ID_QDM2 (0x15015)
CODEC_ID_COOK, #define CODEC_ID_COOK (0x15016)
CODEC_ID_TRUESPEECH, #define CODEC_ID_TRUESPEECH (0x15017)
CODEC_ID_TTA, #define CODEC_ID_TTA (0x15018
CODEC_ID_SMACKAUDIO, #define CODEC_ID_SMACKAUDIO (0x15019)
CODEC_ID_QCELP, #define CODEC_ID_QCELP (0x1501A)
CODEC_ID_WAVPACK, #define CODEC_ID_WAVPACK (0x1501B)
CODEC_ID_DSICINAUDIO, #define CODEC_ID_DSICINAUDIO (0x1501C)
CODEC_ID_IMC, #define CODEC_ID_IMC (0x1501D)
CODEC_ID_MUSEPACK7, #define CODEC_ID_MUSEPACK7 (0x1501E)
CODEC_ID_MLP, #define CODEC_ID_MLP (0x1501F)
CODEC_ID_GSM_MS, /* as found in WAV */ #define CODEC_ID_GSM_MS (0x15020) /* as found in WAV */
CODEC_ID_ATRAC3, #define CODEC_ID_ATRAC3 (0x15021)
CODEC_ID_VOXWARE, #define CODEC_ID_VOXWARE (0x15022)
CODEC_ID_APE, #define CODEC_ID_APE (0x15023)
CODEC_ID_NELLYMOSER, #define CODEC_ID_NELLYMOSER (0x15024)
CODEC_ID_MUSEPACK8, #define CODEC_ID_MUSEPACK8 (0x15025)
CODEC_ID_SPEEX, #define CODEC_ID_SPEEX (0x15026)
CODEC_ID_WMAVOICE, #define CODEC_ID_WMAVOICE (0x15027)
CODEC_ID_WMAPRO, #define CODEC_ID_WMAPRO (0x15028)
CODEC_ID_WMALOSSLESS, #define CODEC_ID_WMALOSSLESS (0x15029)
CODEC_ID_ATRAC3P, #define CODEC_ID_ATRAC3P (0x1502A)
CODEC_ID_EAC3, #define CODEC_ID_EAC3 (0x1502B)
CODEC_ID_SIPR, #define CODEC_ID_SIPR (0x1502C)
CODEC_ID_MP1, #define CODEC_ID_MP1 (0x1502D)
CODEC_ID_TWINVQ, #define CODEC_ID_TWINVQ (0x1502E)
CODEC_ID_TRUEHD, #define CODEC_ID_TRUEHD (0x1502F)
CODEC_ID_MP4ALS, #define CODEC_ID_MP4ALS (0x15030)
CODEC_ID_ATRAC1, #define CODEC_ID_ATRAC1 (0x15031)
CODEC_ID_BINKAUDIO_RDFT, #define CODEC_ID_BINKAUDIO_RDFT (0x15032)
CODEC_ID_BINKAUDIO_DCT, #define CODEC_ID_BINKAUDIO_DCT (0x15033)
/* subtitle codecs */ /* subtitle codecs */
CODEC_ID_DVD_SUBTITLE= 0x17000, #define CODEC_ID_DVD_SUBTITLE (0x17000)
CODEC_ID_DVB_SUBTITLE, #define CODEC_ID_DVB_SUBTITLE (0x17001)
CODEC_ID_TEXT, ///< raw UTF-8 text #define CODEC_ID_TEXT (0x17002) ///< raw UTF-8 text
CODEC_ID_XSUB, #define CODEC_ID_XSUB (0x17003)
CODEC_ID_SSA, #define CODEC_ID_SSA (0x17004)
CODEC_ID_MOV_TEXT, #define CODEC_ID_MOV_TEXT (0x17005)
CODEC_ID_HDMV_PGS_SUBTITLE, #define CODEC_ID_HDMV_PGS_SUBTITLE (0x17006)
CODEC_ID_DVB_TELETEXT, #define CODEC_ID_DVB_TELETEXT (0x17007)
CODEC_ID_SRT, #define CODEC_ID_SRT (0x17008)
/* other specific kind of codecs (generally used for attachments) */ /* other specific kind of codecs (generally used for attachments) */
CODEC_ID_TTF= 0x18000, #define CODEC_ID_TTF (0x18000)
CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it #define CODEC_ID_PROBE (0x19000) ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS #define CODEC_ID_MPEG2TS (0x20000) /**< _FAKE_ codec to indicate a raw MPEG-2 TS
* stream (only used by libavformat) */ * stream (only used by libavformat) */
}; };
@ -1306,7 +1307,7 @@ typedef struct AVCodecContext {
char codec_name[32]; char codec_name[32];
enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
enum CodecID codec_id; /* see CODEC_ID_xxx */ int codec_id; /* see CODEC_ID_xxx */
/** /**
* fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
@ -2721,7 +2722,7 @@ typedef struct AVCodec {
*/ */
const char *name; const char *name;
enum AVMediaType type; enum AVMediaType type;
enum CodecID id; int id; /*enum CodecId*/
int priv_data_size; int priv_data_size;
int (*init)(AVCodecContext *); int (*init)(AVCodecContext *);
int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
@ -2774,7 +2775,7 @@ typedef struct AVHWAccel {
* *
* See CODEC_ID_xxx * See CODEC_ID_xxx
*/ */
enum CodecID id; int id; /*enum CodecID*/
/** /**
* Supported pixel format. * Supported pixel format.
@ -3278,7 +3279,7 @@ void avcodec_register(AVCodec *codec);
* @param id CodecID of the requested encoder * @param id CodecID of the requested encoder
* @return An encoder if one was found, NULL otherwise. * @return An encoder if one was found, NULL otherwise.
*/ */
AVCodec *avcodec_find_encoder(enum CodecID id); AVCodec *avcodec_find_encoder(int codec_id);
/** /**
* Find a registered encoder with the specified name. * Find a registered encoder with the specified name.
@ -3294,7 +3295,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name);
* @param id CodecID of the requested decoder * @param id CodecID of the requested decoder
* @return A decoder if one was found, NULL otherwise. * @return A decoder if one was found, NULL otherwise.
*/ */
AVCodec *avcodec_find_decoder(enum CodecID id); AVCodec *avcodec_find_decoder(int codec_id);
/** /**
* Find a registered decoder with the specified name. * Find a registered decoder with the specified name.
@ -3678,7 +3679,7 @@ char av_get_pict_type_char(int pict_type);
* @param[in] codec_id the codec * @param[in] codec_id the codec
* @return Number of bits per sample or zero if unknown for the given codec. * @return Number of bits per sample or zero if unknown for the given codec.
*/ */
int av_get_bits_per_sample(enum CodecID codec_id); int av_get_bits_per_sample(int codec_id);
/** /**
* Return sample format bits per sample. * Return sample format bits per sample.

View file

@ -40,7 +40,7 @@ int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
* @param pix_fmt the pixel format to match * @param pix_fmt the pixel format to match
* @return the hardware accelerated codec, or NULL if none was found. * @return the hardware accelerated codec, or NULL if none was found.
*/ */
AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt); AVHWAccel *ff_find_hwaccel(int codec_id, enum PixelFormat pix_fmt);
/** /**
* Return the index into tab at which {a,b} match elements {[0],[1]} of tab. * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.

View file

@ -743,12 +743,12 @@ av_cold int avcodec_close(AVCodecContext *avctx)
return 0; return 0;
} }
AVCodec *avcodec_find_encoder(enum CodecID id) AVCodec *avcodec_find_encoder(int codec_id)
{ {
AVCodec *p, *experimental=NULL; AVCodec *p, *experimental=NULL;
p = first_avcodec; p = first_avcodec;
while (p) { while (p) {
if (p->encode != NULL && p->id == id) { if (p->encode != NULL && p->id == codec_id) {
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) { if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
experimental = p; experimental = p;
} else } else
@ -773,12 +773,12 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
return NULL; return NULL;
} }
AVCodec *avcodec_find_decoder(enum CodecID id) AVCodec *avcodec_find_decoder(int codec_id)
{ {
AVCodec *p; AVCodec *p;
p = first_avcodec; p = first_avcodec;
while (p) { while (p) {
if (p->decode != NULL && p->id == id) if (p->decode != NULL && p->id == codec_id)
return p; return p;
p = p->next; p = p->next;
} }
@ -1010,7 +1010,7 @@ char av_get_pict_type_char(int pict_type){
} }
} }
int av_get_bits_per_sample(enum CodecID codec_id){ int av_get_bits_per_sample(int codec_id){
switch(codec_id){ switch(codec_id){
case CODEC_ID_ADPCM_SBPRO_2: case CODEC_ID_ADPCM_SBPRO_2:
return 2; return 2;
@ -1150,7 +1150,7 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
return hwaccel ? hwaccel->next : first_hwaccel; return hwaccel ? hwaccel->next : first_hwaccel;
} }
AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt) AVHWAccel *ff_find_hwaccel(int codec_id, enum PixelFormat pix_fmt)
{ {
AVHWAccel *hwaccel=NULL; AVHWAccel *hwaccel=NULL;