Commit ee73933e authored by diego's avatar diego

prettyprinting cosmetics


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15682 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b4425538
This diff is collapsed.
...@@ -52,9 +52,9 @@ typedef struct DVprofile { ...@@ -52,9 +52,9 @@ typedef struct DVprofile {
int bpm; /* blocks per macroblock */ int bpm; /* blocks per macroblock */
const uint8_t *block_sizes; /* AC block sizes, in bits */ const uint8_t *block_sizes; /* AC block sizes, in bits */
int audio_stride; /* size of audio_shuffle table */ int audio_stride; /* size of audio_shuffle table */
int audio_min_samples[3];/* min amount of audio samples */ int audio_min_samples[3]; /* min amount of audio samples */
/* for 48kHz, 44.1kHz and 32kHz */ /* for 48kHz, 44.1kHz and 32kHz */
int audio_samples_dist[5];/* how many samples are supposed to be */ int audio_samples_dist[5]; /* how many samples are supposed to be */
/* in each frame in a 5 frames window */ /* in each frame in a 5 frames window */
const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
} DVprofile; } DVprofile;
...@@ -6360,7 +6360,8 @@ enum dv_pack_type { ...@@ -6360,7 +6360,8 @@ enum dv_pack_type {
#define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1)) #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
#define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1)) #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1))
/* minimum number of bytes to read from a DV stream in order to determine the profile */ /* minimum number of bytes to read from a DV stream in order to
determine the profile */
#define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */ #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */
/** /**
...@@ -6398,18 +6399,20 @@ static const DVprofile* dv_codec_profile(AVCodecContext* codec) ...@@ -6398,18 +6399,20 @@ static const DVprofile* dv_codec_profile(AVCodecContext* codec)
int i; int i;
for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt && if (codec->height == dv_profiles[i].height &&
codec->pix_fmt == dv_profiles[i].pix_fmt &&
codec->width == dv_profiles[i].width) codec->width == dv_profiles[i].width)
return &dv_profiles[i]; return &dv_profiles[i];
return NULL; return NULL;
} }
static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num, uint8_t seq_num, static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
uint8_t dif_num, uint8_t* buf) uint8_t seq_num, uint8_t dif_num,
uint8_t* buf)
{ {
buf[0] = (uint8_t)t; /* Section type */ buf[0] = (uint8_t)t; /* Section type */
buf[1] = (seq_num<<4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */ buf[1] = (seq_num << 4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */
(chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */ (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */
7; /* reserved -- always 1 */ 7; /* reserved -- always 1 */
buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */ buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */
...@@ -6420,17 +6423,17 @@ static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num, uint ...@@ -6420,17 +6423,17 @@ static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num, uint
static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf) static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf)
{ {
if (syb_num == 0 || syb_num == 6) { if (syb_num == 0 || syb_num == 6) {
buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
(0<<4) | /* AP3 (Subcode application ID) */ (0 << 4) | /* AP3 (Subcode application ID) */
0x0f; /* reserved -- always 1 */ 0x0f; /* reserved -- always 1 */
} }
else if (syb_num == 11) { else if (syb_num == 11) {
buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
0x7f; /* reserved -- always 1 */ 0x7f; /* reserved -- always 1 */
} }
else { else {
buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
(0<<4) | /* APT (Track application ID) */ (0 << 4) | /* APT (Track application ID) */
0x0f; /* reserved -- always 1 */ 0x0f; /* reserved -- always 1 */
} }
buf[1] = 0xf0 | /* reserved -- always 1 */ buf[1] = 0xf0 | /* reserved -- always 1 */
......
...@@ -119,11 +119,11 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4], ...@@ -119,11 +119,11 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4],
return -1; /* unsupported quantization */ return -1; /* unsupported quantization */
size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */ size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
half_ch = sys->difseg_size/2; half_ch = sys->difseg_size / 2;
/* We work with 720p frames split in half, thus even frames have /* We work with 720p frames split in half, thus even frames have
* channels 0,1 and odd 2,3 */ * channels 0,1 and odd 2,3. */
ipcm = (sys->height == 720 && !(frame[1]&0x0C))?2:0; ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0;
pcm = ppcm[ipcm++]; pcm = ppcm[ipcm++];
/* for each DIF channel */ /* for each DIF channel */
...@@ -142,7 +142,7 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4], ...@@ -142,7 +142,7 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4],
for (j = 0; j < 9; j++) { for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) { for (d = 8; d < 80; d += 2) {
if (quant == 0) { /* 16bit quantization */ if (quant == 0) { /* 16bit quantization */
of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride; of = sys->audio_shuffle[i][j] + (d - 8) / 2 * sys->audio_stride;
if (of*2 >= size) if (of*2 >= size)
continue; continue;
...@@ -158,14 +158,14 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4], ...@@ -158,14 +158,14 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4],
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride; of = sys->audio_shuffle[i%half_ch][j] + (d - 8) / 3 * sys->audio_stride;
if (of*2 >= size) if (of*2 >= size)
continue; continue;
pcm[of*2] = lc & 0xff; // FIXME: maybe we have to admit pcm[of*2] = lc & 0xff; // FIXME: maybe we have to admit
pcm[of*2+1] = lc >> 8; // that DV is a big-endian PCM pcm[of*2+1] = lc >> 8; // that DV is a big-endian PCM
of = sys->audio_shuffle[i%half_ch+half_ch][j] + of = sys->audio_shuffle[i%half_ch+half_ch][j] +
(d - 8)/3 * sys->audio_stride; (d - 8) / 3 * sys->audio_stride;
pcm[of*2] = rc & 0xff; // FIXME: maybe we have to admit pcm[of*2] = rc & 0xff; // FIXME: maybe we have to admit
pcm[of*2+1] = rc >> 8; // that DV is a big-endian PCM pcm[of*2+1] = rc >> 8; // that DV is a big-endian PCM
++d; ++d;
...@@ -207,7 +207,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) ...@@ -207,7 +207,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
ach = 2; ach = 2;
/* Dynamic handling of the audio streams in DV */ /* Dynamic handling of the audio streams in DV */
for (i=0; i<ach; i++) { for (i = 0; i < ach; i++) {
if (!c->ast[i]) { if (!c->ast[i]) {
c->ast[i] = av_new_stream(c->fctx, 0); c->ast[i] = av_new_stream(c->fctx, 0);
if (!c->ast[i]) if (!c->ast[i])
...@@ -242,9 +242,10 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame) ...@@ -242,9 +242,10 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
if (c->sys) { if (c->sys) {
avctx = c->vst->codec; avctx = c->vst->codec;
av_set_pts_info(c->vst, 64, c->sys->time_base.num, c->sys->time_base.den); av_set_pts_info(c->vst, 64, c->sys->time_base.num,
c->sys->time_base.den);
avctx->time_base= c->sys->time_base; avctx->time_base= c->sys->time_base;
if(!avctx->width){ if (!avctx->width){
avctx->width = c->sys->width; avctx->width = c->sys->width;
avctx->height = c->sys->height; avctx->height = c->sys->height;
} }
...@@ -301,7 +302,7 @@ int dv_get_packet(DVDemuxContext *c, AVPacket *pkt) ...@@ -301,7 +302,7 @@ int dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
int size = -1; int size = -1;
int i; int i;
for (i=0; i<c->ach; i++) { for (i = 0; i < c->ach; i++) {
if (c->ast[i] && c->audio_pkt[i].size) { if (c->ast[i] && c->audio_pkt[i].size) {
*pkt = c->audio_pkt[i]; *pkt = c->audio_pkt[i];
c->audio_pkt[i].size = 0; c->audio_pkt[i].size = 0;
...@@ -328,7 +329,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, ...@@ -328,7 +329,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
/* Queueing audio packet */ /* Queueing audio packet */
/* FIXME: in case of no audio/bad audio we have to do something */ /* FIXME: in case of no audio/bad audio we have to do something */
size = dv_extract_audio_info(c, buf); size = dv_extract_audio_info(c, buf);
for (i=0; i<c->ach; i++) { for (i = 0; i < c->ach; i++) {
c->audio_pkt[i].size = size; c->audio_pkt[i].size = size;
c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate; c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
ppcm[i] = c->audio_buf[i]; ppcm[i] = c->audio_buf[i];
...@@ -339,7 +340,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, ...@@ -339,7 +340,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
/* We work with 720p frames split in half, thus even frames have /* We work with 720p frames split in half, thus even frames have
* channels 0,1 and odd 2,3. */ * channels 0,1 and odd 2,3. */
if (c->sys->height == 720) { if (c->sys->height == 720) {
if (buf[1]&0x0C) if (buf[1] & 0x0C)
c->audio_pkt[2].size = c->audio_pkt[3].size = 0; c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
else else
c->audio_pkt[0].size = c->audio_pkt[1].size = 0; c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
...@@ -444,12 +445,12 @@ static int dv_read_seek(AVFormatContext *s, int stream_index, ...@@ -444,12 +445,12 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
{ {
RawDVContext *r = s->priv_data; RawDVContext *r = s->priv_data;
DVDemuxContext *c = r->dv_demux; DVDemuxContext *c = r->dv_demux;
int64_t offset= dv_frame_offset(s, c, timestamp, flags); int64_t offset = dv_frame_offset(s, c, timestamp, flags);
dv_offset_reset(c, offset / c->sys->frame_size); dv_offset_reset(c, offset / c->sys->frame_size);
offset = url_fseek(s->pb, offset, SEEK_SET); offset = url_fseek(s->pb, offset, SEEK_SET);
return (offset < 0)?offset:0; return (offset < 0) ? offset : 0;
} }
static int dv_read_close(AVFormatContext *s) static int dv_read_close(AVFormatContext *s)
......
...@@ -63,7 +63,7 @@ static const int dv_aaux_packs_dist[12][9] = { ...@@ -63,7 +63,7 @@ static const int dv_aaux_packs_dist[12][9] = {
static int dv_audio_frame_size(const DVprofile* sys, int frame) static int dv_audio_frame_size(const DVprofile* sys, int frame)
{ {
return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist) /
sizeof(sys->audio_samples_dist[0]))]; sizeof(sys->audio_samples_dist[0]))];
} }
...@@ -77,14 +77,14 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu ...@@ -77,14 +77,14 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
buf[0] = (uint8_t)pack_id; buf[0] = (uint8_t)pack_id;
switch (pack_id) { switch (pack_id) {
case dv_timecode: case dv_timecode:
ct = (time_t)av_rescale_rnd(c->frames, c->sys->time_base.num, c->sys->time_base.den, ct = (time_t)av_rescale_rnd(c->frames, c->sys->time_base.num,
AV_ROUND_DOWN); c->sys->time_base.den, AV_ROUND_DOWN);
brktimegm(ct, &tc); brktimegm(ct, &tc);
/* /*
* LTC drop-frame frame counter drops two frames (0 and 1) every * LTC drop-frame frame counter drops two frames (0 and 1) every
* minute, unless it is exactly divisible by 10 * minute, unless it is exactly divisible by 10
*/ */
ltc_frame = (c->frames + 2*ct/60 - 2*ct/600) % c->sys->ltc_divisor; ltc_frame = (c->frames + 2 * ct / 60 - 2 * ct / 600) % c->sys->ltc_divisor;
buf[1] = (0 << 7) | /* color frame: 0 - unsync; 1 - sync mode */ buf[1] = (0 << 7) | /* color frame: 0 - unsync; 1 - sync mode */
(1 << 6) | /* drop frame timecode: 0 - nondrop; 1 - drop */ (1 << 6) | /* drop frame timecode: 0 - nondrop; 1 - drop */
((ltc_frame / 10) << 4) | /* tens of frames */ ((ltc_frame / 10) << 4) | /* tens of frames */
...@@ -132,7 +132,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu ...@@ -132,7 +132,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
7; 7;
buf[3] = (1 << 7) | /* direction: 1 -- forward */ buf[3] = (1 << 7) | /* direction: 1 -- forward */
(c->sys->pix_fmt == PIX_FMT_YUV420P ? 0x20 : /* speed */ (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0x20 : /* speed */
c->sys->ltc_divisor*4); c->sys->ltc_divisor * 4);
buf[4] = (1 << 7) | /* reserved -- always 1 */ buf[4] = (1 << 7) | /* reserved -- always 1 */
0x7f; /* genre category */ 0x7f; /* genre category */
break; break;
...@@ -264,10 +264,10 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st, ...@@ -264,10 +264,10 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st,
} }
/* Let us see if we have enough data to construct one DV frame. */ /* Let us see if we have enough data to construct one DV frame. */
if (c->has_video == 1 && c->has_audio + 1 == 1<<c->n_ast) { if (c->has_video == 1 && c->has_audio + 1 == 1 << c->n_ast) {
dv_inject_metadata(c, *frame); dv_inject_metadata(c, *frame);
c->has_audio = 0; c->has_audio = 0;
for (i=0; i<c->n_ast; i++) { for (i=0; i < c->n_ast; i++) {
dv_inject_audio(c, i, *frame); dv_inject_audio(c, i, *frame);
av_fifo_drain(&c->audio_data[i], reqasize); av_fifo_drain(&c->audio_data[i], reqasize);
c->has_audio |= ((reqasize <= av_fifo_size(&c->audio_data[i])) << i); c->has_audio |= ((reqasize <= av_fifo_size(&c->audio_data[i])) << i);
...@@ -325,7 +325,7 @@ DVMuxContext* dv_init_mux(AVFormatContext* s) ...@@ -325,7 +325,7 @@ DVMuxContext* dv_init_mux(AVFormatContext* s)
if (!c->sys) if (!c->sys)
goto bail_out; goto bail_out;
if((c->n_ast > 1) && (c->sys->n_difchan < 2)) { if ((c->n_ast > 1) && (c->sys->n_difchan < 2)) {
/* only 1 stereo pair is allowed in 25Mbps mode */ /* only 1 stereo pair is allowed in 25Mbps mode */
goto bail_out; goto bail_out;
} }
...@@ -336,9 +336,9 @@ DVMuxContext* dv_init_mux(AVFormatContext* s) ...@@ -336,9 +336,9 @@ DVMuxContext* dv_init_mux(AVFormatContext* s)
c->has_video = 0; c->has_video = 0;
c->start_time = (time_t)s->timestamp; c->start_time = (time_t)s->timestamp;
for (i=0; i<c->n_ast; i++) { for (i=0; i < c->n_ast; i++) {
if (c->ast[i] && av_fifo_init(&c->audio_data[i], 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0) { if (c->ast[i] && av_fifo_init(&c->audio_data[i], 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0) {
while (i>0) { while (i > 0) {
i--; i--;
av_fifo_free(&c->audio_data[i]); av_fifo_free(&c->audio_data[i]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment