diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-08-23 12:04:58 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-09-05 08:10:26 +0200 |
commit | f7b3fc4afe6540506257c73a93a3f4272c250d44 (patch) | |
tree | 229d51ecb1be9de7cb5a2e931f5edb4421f428d6 /libavformat | |
parent | 7203bb6a59c55e853855b2e60e3fbc6d2f65dce1 (diff) | |
download | ffmpeg-f7b3fc4afe6540506257c73a93a3f4272c250d44.tar.gz |
lavc/dv: rename constants to follow our naming conventions
CamelCase for enum tags, ALL_CAPS for enum values.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/dv.c | 18 | ||||
-rw-r--r-- | libavformat/dvenc.c | 34 |
2 files changed, 26 insertions, 26 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c index 24bacd5c53..303cecf9bb 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -87,26 +87,26 @@ static inline uint16_t dv_audio_12to16(uint16_t sample) return result; } -static const uint8_t *dv_extract_pack(const uint8_t *frame, enum dv_pack_type t) +static const uint8_t *dv_extract_pack(const uint8_t *frame, enum DVPackType t) { int offs; int c; for (c = 0; c < 10; c++) { switch (t) { - case dv_audio_source: + case DV_AUDIO_SOURCE: if (c&1) offs = (80 * 6 + 80 * 16 * 0 + 3 + c*12000); else offs = (80 * 6 + 80 * 16 * 3 + 3 + c*12000); break; - case dv_audio_control: + case DV_AUDIO_CONTROL: if (c&1) offs = (80 * 6 + 80 * 16 * 1 + 3 + c*12000); else offs = (80 * 6 + 80 * 16 * 4 + 3 + c*12000); break; - case dv_video_control: + case DV_VIDEO_CONTROL: if (c&1) offs = (80 * 3 + 8 + c*12000); else offs = (80 * 5 + 48 + 5 + c*12000); break; - case dv_timecode: + case DV_TIMECODE: offs = (80*1 + 3 + 3); break; default: @@ -139,7 +139,7 @@ static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm, const uint8_t *as_pack; uint8_t *pcm, ipcm; - as_pack = dv_extract_pack(frame, dv_audio_source); + as_pack = dv_extract_pack(frame, DV_AUDIO_SOURCE); if (!as_pack) /* No audio ? */ return 0; @@ -239,7 +239,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame) const uint8_t *as_pack; int freq, stype, smpls, quant, i, ach; - as_pack = dv_extract_pack(frame, dv_audio_source); + as_pack = dv_extract_pack(frame, DV_AUDIO_SOURCE); if (!as_pack || !c->sys) { /* No audio ? */ c->ach = 0; return 0; @@ -308,7 +308,7 @@ static int dv_extract_video_info(DVDemuxContext *c, const uint8_t *frame) c->vst->avg_frame_rate = av_inv_q(c->vst->time_base); /* finding out SAR is a little bit messy */ - vsc_pack = dv_extract_pack(frame, dv_video_control); + vsc_pack = dv_extract_pack(frame, DV_VIDEO_CONTROL); apt = frame[4] & 0x07; is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07))); @@ -328,7 +328,7 @@ static int dv_extract_timecode(DVDemuxContext* c, const uint8_t* frame, char *tc // is only relevant for NTSC systems. int prevent_df = c->sys->ltc_divisor == 25 || c->sys->ltc_divisor == 50; - tc_pack = dv_extract_pack(frame, dv_timecode); + tc_pack = dv_extract_pack(frame, DV_TIMECODE); if (!tc_pack) return 0; av_timecode_make_smpte_tc_string2(tc, av_inv_q(c->sys->time_base), AV_RB32(tc_pack + 1), prevent_df, 1); diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 429ddcb96c..11947aa493 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -94,7 +94,7 @@ static int dv_audio_frame_size(const AVDVProfile* sys, int frame, int sample_rat sizeof(sys->audio_samples_dist[0]))]; } -static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf, int channel, int seq) +static int dv_write_pack(enum DVPackType pack_id, DVMuxContext *c, uint8_t* buf, int channel, int seq) { struct tm tc; time_t ct; @@ -103,12 +103,12 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu buf[0] = (uint8_t)pack_id; switch (pack_id) { - case dv_timecode: + case DV_TIMECODE: timecode = av_timecode_get_smpte_from_framenum(&c->tc, c->frames); timecode |= 1<<23 | 1<<15 | 1<<7 | 1<<6; // biphase and binary group flags AV_WB32(buf + 1, timecode); break; - case dv_audio_source: /* AAUX source pack */ + case DV_AUDIO_SOURCE: /* AAUX source pack */ if (c->ast[channel]->codecpar->sample_rate == 44100) { audio_type = 1; } else if (c->ast[channel]->codecpar->sample_rate == 32000) @@ -132,7 +132,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu 0; /* quantization: 0 -- 16-bit linear, 1 -- 12-bit nonlinear */ break; - case dv_audio_control: + case DV_AUDIO_CONTROL: buf[1] = (0 << 6) | /* copy protection: 0 -- unrestricted */ (1 << 4) | /* input source: 1 -- digital input */ (3 << 2) | /* compression: 3 -- no information */ @@ -147,8 +147,8 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu buf[4] = (1 << 7) | /* reserved -- always 1 */ 0x7f; /* genre category */ break; - case dv_audio_recdate: - case dv_video_recdate: /* VAUX recording date */ + case DV_AUDIO_RECDATE: + case DV_VIDEO_RECDATE: /* VAUX recording date */ ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num, c->sys->time_base.den, AV_ROUND_DOWN); brktimegm(ct, &tc); @@ -163,8 +163,8 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */ (tc.tm_year % 10); /* Units of year */ break; - case dv_audio_rectime: /* AAUX recording time */ - case dv_video_rectime: /* VAUX recording time */ + case DV_AUDIO_RECTIME: /* AAUX recording time */ + case DV_VIDEO_RECTIME: /* VAUX recording time */ ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num, c->sys->time_base.den, AV_ROUND_DOWN); brktimegm(ct, &tc); @@ -219,22 +219,22 @@ static void dv_inject_metadata(DVMuxContext *c, uint8_t* frame) /* DV subcode: 2nd and 3d DIFs */ for (j = 80; j < 80 * 3; j += 80) { for (k = 6; k < 6 * 8; k += 8) - dv_write_pack(dv_timecode, c, &buf[j+k], 0, seq); + dv_write_pack(DV_TIMECODE, c, &buf[j+k], 0, seq); if (((long)(buf-frame)/(c->sys->frame_size/(c->sys->difseg_size*c->sys->n_difchan))%c->sys->difseg_size) > 5) { /* FIXME: is this really needed ? */ - dv_write_pack(dv_video_recdate, c, &buf[j+14], 0, seq); - dv_write_pack(dv_video_rectime, c, &buf[j+22], 0, seq); - dv_write_pack(dv_video_recdate, c, &buf[j+38], 0, seq); - dv_write_pack(dv_video_rectime, c, &buf[j+46], 0, seq); + dv_write_pack(DV_VIDEO_RECDATE, c, &buf[j+14], 0, seq); + dv_write_pack(DV_VIDEO_RECTIME, c, &buf[j+22], 0, seq); + dv_write_pack(DV_VIDEO_RECDATE, c, &buf[j+38], 0, seq); + dv_write_pack(DV_VIDEO_RECTIME, c, &buf[j+46], 0, seq); } } /* DV VAUX: 4th, 5th and 6th 3DIFs */ for (j = 80*3 + 3; j < 80*6; j += 80) { - dv_write_pack(dv_video_recdate, c, &buf[j+5* 2], 0, seq); - dv_write_pack(dv_video_rectime, c, &buf[j+5* 3], 0, seq); - dv_write_pack(dv_video_recdate, c, &buf[j+5*11], 0, seq); - dv_write_pack(dv_video_rectime, c, &buf[j+5*12], 0, seq); + dv_write_pack(DV_VIDEO_RECDATE, c, &buf[j+5* 2], 0, seq); + dv_write_pack(DV_VIDEO_RECTIME, c, &buf[j+5* 3], 0, seq); + dv_write_pack(DV_VIDEO_RECDATE, c, &buf[j+5*11], 0, seq); + dv_write_pack(DV_VIDEO_RECTIME, c, &buf[j+5*12], 0, seq); } } } |