2009-05-01 09:31:59 -04:00
|
|
|
|
|
|
|
#ifndef __TRANSCODE_H__
|
|
|
|
#define __TRANSCODE_H__
|
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
#include <event2/buffer.h>
|
|
|
|
#include "db.h"
|
2015-03-20 18:40:42 -04:00
|
|
|
#include "http.h"
|
2009-05-01 09:31:59 -04:00
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
#define XCODE_WAVHEADER (1 << 14)
|
|
|
|
#define XCODE_HAS_VIDEO (1 << 15)
|
|
|
|
|
|
|
|
enum transcode_profile
|
|
|
|
{
|
|
|
|
// Transcodes the best available audio stream into PCM16 (does not add wav header)
|
|
|
|
XCODE_PCM16_NOHEADER = 1,
|
|
|
|
// Transcodes the best available audio stream into PCM16 (with wav header)
|
|
|
|
XCODE_PCM16_HEADER = XCODE_WAVHEADER | 2,
|
|
|
|
// Transcodes the best available audio stream into MP3
|
|
|
|
XCODE_MP3 = 3,
|
|
|
|
// Transcodes video + audio + subtitle streams (not tested - for future use)
|
|
|
|
XCODE_H264_AAC = XCODE_HAS_VIDEO | 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct decode_ctx;
|
|
|
|
struct encode_ctx;
|
2009-05-01 09:31:59 -04:00
|
|
|
struct transcode_ctx;
|
2015-10-09 17:58:27 -04:00
|
|
|
struct decoded_frame;
|
2009-05-01 09:31:59 -04:00
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
// Setting up
|
|
|
|
struct decode_ctx *
|
|
|
|
transcode_decode_setup(struct media_file_info *mfi, int decode_video);
|
2009-05-01 09:31:59 -04:00
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
struct encode_ctx *
|
|
|
|
transcode_encode_setup(struct decode_ctx *src_ctx, enum transcode_profile profile, off_t *est_size);
|
2010-04-04 06:34:28 -04:00
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
struct transcode_ctx *
|
|
|
|
transcode_setup(struct media_file_info *mfi, enum transcode_profile profile, off_t *est_size);
|
2009-05-01 09:31:59 -04:00
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
struct decode_ctx *
|
|
|
|
transcode_decode_setup_raw(void);
|
2009-05-01 09:31:59 -04:00
|
|
|
|
|
|
|
int
|
2014-08-22 18:02:01 -04:00
|
|
|
transcode_needed(const char *user_agent, const char *client_codecs, char *file_codectype);
|
2009-05-01 09:31:59 -04:00
|
|
|
|
2015-10-09 17:58:27 -04:00
|
|
|
// Cleaning up
|
|
|
|
void
|
|
|
|
transcode_decode_cleanup(struct decode_ctx *ctx);
|
|
|
|
|
|
|
|
void
|
|
|
|
transcode_encode_cleanup(struct encode_ctx *ctx);
|
|
|
|
|
2015-03-14 16:42:53 -04:00
|
|
|
void
|
2015-10-09 17:58:27 -04:00
|
|
|
transcode_cleanup(struct transcode_ctx *ctx);
|
2015-03-14 16:42:53 -04:00
|
|
|
|
|
|
|
void
|
2015-10-09 17:58:27 -04:00
|
|
|
transcode_decoded_free(struct decoded_frame *decoded);
|
|
|
|
|
|
|
|
// Transcoding
|
|
|
|
struct decoded_frame *
|
|
|
|
transcode_decode(struct decode_ctx *ctx);
|
|
|
|
|
|
|
|
int
|
|
|
|
transcode_encode(struct evbuffer *evbuf, struct decoded_frame *decoded, struct encode_ctx *ctx);
|
|
|
|
|
|
|
|
int
|
|
|
|
transcode(struct transcode_ctx *ctx, struct evbuffer *evbuf, int wanted, int *icy_timer);
|
|
|
|
|
|
|
|
struct decoded_frame *
|
|
|
|
transcode_raw2frame(uint8_t *data, size_t size);
|
|
|
|
|
|
|
|
// Seeking
|
|
|
|
int
|
|
|
|
transcode_seek(struct transcode_ctx *ctx, int ms);
|
|
|
|
|
|
|
|
// Metadata
|
|
|
|
struct http_icy_metadata *
|
|
|
|
transcode_metadata(struct transcode_ctx *ctx, int *changed);
|
|
|
|
|
|
|
|
char *
|
|
|
|
transcode_metadata_artwork_url(struct transcode_ctx *ctx);
|
2015-03-14 16:42:53 -04:00
|
|
|
|
2009-05-01 09:31:59 -04:00
|
|
|
#endif /* !__TRANSCODE_H__ */
|