Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

general changes and improvements #51

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/ltc.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,21 +312,21 @@ void ltc_encoder_set_user_bits(LTCEncoder *e, unsigned long data){

unsigned long ltc_frame_get_user_bits(LTCFrame *f){
unsigned long data = 0;
data += f->user8;
data |= f->user8;
data <<= 4;
data += f->user7;
data |= f->user7;
data <<= 4;
data += f->user6;
data |= f->user6;
data <<= 4;
data += f->user5;
data |= f->user5;
data <<= 4;
data += f->user4;
data |= f->user4;
data <<= 4;
data += f->user3;
data |= f->user3;
data <<= 4;
data += f->user2;
data |= f->user2;
data <<= 4;
data += f->user1;
data |= f->user1;
return data;
}

Expand Down Expand Up @@ -362,9 +362,9 @@ int ltc_encoder_get_bufferptr(LTCEncoder *e, ltcsnd_sample_t **buf, int flush) {
}

ltcsnd_sample_t *ltc_encoder_get_bufptr(LTCEncoder *e, int *size, int flush) {
if (size) *size = e->offset;
if (flush) e->offset = 0;
return e->buf;
ltcsnd_sample_t *buf;
*size = ltc_encoder_get_bufferptr(e, &buf, flush);
return buf;
}

int ltc_encoder_copy_buffer(LTCEncoder *e, ltcsnd_sample_t *buf) {
Expand Down
27 changes: 24 additions & 3 deletions src/ltc.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ void ltc_encoder_get_frame(LTCEncoder *e, LTCFrame *f);
* to hold \ref ltc_encoder_get_buffersize bytes
* @return the number of bytes written to the memory area
* pointed to by buf.
*
* @deprecated please use ltc_encoder_copy_buffer() instead
*/
int ltc_encoder_get_buffer(LTCEncoder *e, ltcsnd_sample_t *buf) DEPRECATED_EXPORT;
Expand All @@ -640,7 +639,17 @@ int ltc_encoder_copy_buffer(LTCEncoder *e, ltcsnd_sample_t *buf);
* @param size if set, the number of valid bytes in the buffer is stored there
* @param flush call \ref ltc_encoder_buffer_flush - reset the buffer write-pointer
* @return pointer to encoder-buffer
* @deprecated please use ltc_encoder_get_bufferptr() instead
*/
ltcsnd_sample_t *ltc_encoder_get_bufptr(LTCEncoder *e, int *size, int flush) DEPRECATED_EXPORT;

/**
* Retrieve a pointer to the accumulated encoded audio-data.
*
* @param e encoder handle
* @param buf if set, the pointer to encoder-buffer
* @param flush call \ref ltc_encoder_buffer_flush - reset the buffer write-pointer
* @return the number of valid bytes in the buffer
* @deprecated please use ltc_encoder_get_bufferptr() instead
*/
ltcsnd_sample_t *ltc_encoder_get_bufptr(LTCEncoder *e, int *size, int flush) DEPRECATED_EXPORT;
Expand Down Expand Up @@ -726,7 +735,6 @@ void ltc_encoder_reset(LTCEncoder *e);
* @param fps video-frames per second (e.g. 25.0)
* @return 0 on success, -1 if allocation fails (which makes the
* encoder unusable, call \ref ltc_encoder_free or realloc the buffer)
*
* @deprecated please use ltc_encoder_set_buffersize() instead
*/
int ltc_encoder_set_bufsize(LTCEncoder *e, double sample_rate, double fps) DEPRECATED_EXPORT;
Expand Down Expand Up @@ -882,8 +890,21 @@ void ltc_frame_set_parity(LTCFrame *frame, enum LTC_TV_STANDARD standard);
* @param frame LTC frame data analyze
* @param standard the TV standard to use -- see \ref LTCFrame for BGF assignment
* @return LTC Binary Group Flags
* @deprecated please use ltc_frame_parse_bcg_flags() instead
*/
int parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard) DEPRECATED_EXPORT;

/**
* Parse Binary Group Flags into standard independent format:
* bit 0 (1) - BGF 0,
* bit 1 (2) - BGF 1,
* bit 2 (4) - BGF 2
*
* @param f LTC frame data analyze
* @param standard the TV standard to use -- see \ref LTCFrame for BGF assignment
* @return LTC Binary Group Flags
*/
int ltc_parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard);
int ltc_frame_parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard);

/**
* LTCFrame sample alignment offset.
Expand Down
6 changes: 5 additions & 1 deletion src/timecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ int ltc_frame_decrement(LTCFrame* frame, int fps, enum LTC_TV_STANDARD standard,
return rv;
}

int ltc_parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard) {
int ltc_frame_parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard) {
switch (standard) {
case LTC_TV_625_50: /* 25 fps mode */
return (
Expand All @@ -449,3 +449,7 @@ int ltc_parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard) {
break;
}
}

int parse_bcg_flags(LTCFrame *frame, enum LTC_TV_STANDARD standard) {
return ltc_frame_parse_bcg_flags(frame, standard);
}