libdirac/libschroedinger: Drop unnecessary symbol prefixes.

The names used in the libdirac/libschroedinger wrappers are long enough as-is.
Bloating them with unnecessary prefixes makes them even more unwieldy.
pull/2/head
Diego Biurrun 13 years ago
parent d94c577d3c
commit 45235d69c2
  1. 2
      libavcodec/libdirac.h
  2. 16
      libavcodec/libdirac_libschro.c
  3. 28
      libavcodec/libdirac_libschro.h
  4. 24
      libavcodec/libdiracdec.c
  5. 30
      libavcodec/libdiracenc.c
  6. 8
      libavcodec/libschroedinger.c
  7. 2
      libavcodec/libschroedinger.h
  8. 46
      libavcodec/libschroedingerdec.c
  9. 33
      libavcodec/libschroedingerenc.c

@ -35,7 +35,7 @@
static const struct { static const struct {
enum PixelFormat ff_pix_fmt; enum PixelFormat ff_pix_fmt;
dirac_chroma_t dirac_pix_fmt; dirac_chroma_t dirac_pix_fmt;
} ffmpeg_dirac_pixel_format_map[] = { } dirac_pixel_format_map[] = {
{ PIX_FMT_YUV420P, format420 }, { PIX_FMT_YUV420P, format420 },
{ PIX_FMT_YUV422P, format422 }, { PIX_FMT_YUV422P, format422 },
{ PIX_FMT_YUV444P, format444 }, { PIX_FMT_YUV444P, format444 },

@ -25,7 +25,7 @@
#include "libdirac_libschro.h" #include "libdirac_libschro.h"
static const FfmpegDiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = { static const DiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = {
{ 640, 480, 24000, 1001}, { 640, 480, 24000, 1001},
{ 176, 120, 15000, 1001}, { 176, 120, 15000, 1001},
{ 176, 144, 25, 2 }, { 176, 144, 25, 2 },
@ -53,7 +53,7 @@ unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext)
sizeof(ff_dirac_schro_video_format_info[0]); sizeof(ff_dirac_schro_video_format_info[0]);
for (idx = 1; idx < num_formats; ++idx) { for (idx = 1; idx < num_formats; ++idx) {
const FfmpegDiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx]; const DiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx];
if (avccontext->width == vf->width && if (avccontext->width == vf->width &&
avccontext->height == vf->height) { avccontext->height == vf->height) {
ret_idx = idx; ret_idx = idx;
@ -65,22 +65,22 @@ unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext)
return ret_idx; return ret_idx;
} }
void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue) void ff_dirac_schro_queue_init(DiracSchroQueue *queue)
{ {
queue->p_head = queue->p_tail = NULL; queue->p_head = queue->p_tail = NULL;
queue->size = 0; queue->size = 0;
} }
void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue, void ff_dirac_schro_queue_free(DiracSchroQueue *queue,
void (*free_func)(void *)) void (*free_func)(void *))
{ {
while (queue->p_head) while (queue->p_head)
free_func(ff_dirac_schro_queue_pop(queue)); free_func(ff_dirac_schro_queue_pop(queue));
} }
int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data) int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data)
{ {
FfmpegDiracSchroQueueElement *p_new = av_mallocz(sizeof(FfmpegDiracSchroQueueElement)); DiracSchroQueueElement *p_new = av_mallocz(sizeof(DiracSchroQueueElement));
if (!p_new) if (!p_new)
return -1; return -1;
@ -97,9 +97,9 @@ int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data)
return 0; return 0;
} }
void *ff_dirac_schro_queue_pop(FfmpegDiracSchroQueue *queue) void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue)
{ {
FfmpegDiracSchroQueueElement *top = queue->p_head; DiracSchroQueueElement *top = queue->p_head;
if (top) { if (top) {
void *data = top->data; void *data = top->data;

@ -33,7 +33,7 @@ typedef struct {
uint16_t height; uint16_t height;
uint16_t frame_rate_num; uint16_t frame_rate_num;
uint16_t frame_rate_denom; uint16_t frame_rate_denom;
} FfmpegDiracSchroVideoFormatInfo; } DiracSchroVideoFormatInfo;
/** /**
* Returns the index into the Dirac Schro common video format info table * Returns the index into the Dirac Schro common video format info table
@ -43,7 +43,7 @@ unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext);
/** /**
* contains a single encoded frame returned from Dirac or Schroedinger * contains a single encoded frame returned from Dirac or Schroedinger
*/ */
typedef struct FfmpegDiracSchroEncodedFrame { typedef struct DiracSchroEncodedFrame {
/** encoded frame data */ /** encoded frame data */
uint8_t *p_encbuf; uint8_t *p_encbuf;
@ -55,51 +55,51 @@ typedef struct FfmpegDiracSchroEncodedFrame {
/** key frame flag. 1 : is key frame , 0 : in not key frame */ /** key frame flag. 1 : is key frame , 0 : in not key frame */
uint16_t key_frame; uint16_t key_frame;
} FfmpegDiracSchroEncodedFrame; } DiracSchroEncodedFrame;
/** /**
* queue element * queue element
*/ */
typedef struct FfmpegDiracSchroQueueElement { typedef struct DiracSchroQueueElement {
/** Data to be stored in queue*/ /** Data to be stored in queue*/
void *data; void *data;
/** Pointer to next element queue */ /** Pointer to next element queue */
struct FfmpegDiracSchroQueueElement *next; struct DiracSchroQueueElement *next;
} FfmpegDiracSchroQueueElement; } DiracSchroQueueElement;
/** /**
* A simple queue implementation used in libdirac and libschroedinger * A simple queue implementation used in libdirac and libschroedinger
*/ */
typedef struct FfmpegDiracSchroQueue { typedef struct DiracSchroQueue {
/** Pointer to head of queue */ /** Pointer to head of queue */
FfmpegDiracSchroQueueElement *p_head; DiracSchroQueueElement *p_head;
/** Pointer to tail of queue */ /** Pointer to tail of queue */
FfmpegDiracSchroQueueElement *p_tail; DiracSchroQueueElement *p_tail;
/** Queue size*/ /** Queue size*/
int size; int size;
} FfmpegDiracSchroQueue; } DiracSchroQueue;
/** /**
* Initialise the queue * Initialise the queue
*/ */
void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue); void ff_dirac_schro_queue_init(DiracSchroQueue *queue);
/** /**
* Add an element to the end of the queue * Add an element to the end of the queue
*/ */
int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data); int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data);
/** /**
* Return the first element in the queue * Return the first element in the queue
*/ */
void *ff_dirac_schro_queue_pop(FfmpegDiracSchroQueue *queue); void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue);
/** /**
* Free the queue resources. free_func is a function supplied by the caller to * Free the queue resources. free_func is a function supplied by the caller to
* free any resources allocated by the caller. The data field of the queue * free any resources allocated by the caller. The data field of the queue
* element is passed to it. * element is passed to it.
*/ */
void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue, void ff_dirac_schro_queue_free(DiracSchroQueue *queue,
void (*free_func)(void *)); void (*free_func)(void *));
#endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */ #endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */

@ -37,34 +37,34 @@
#include <libdirac_decoder/dirac_parser.h> #include <libdirac_decoder/dirac_parser.h>
/** contains a single frame returned from Dirac */ /** contains a single frame returned from Dirac */
typedef struct FfmpegDiracDecoderParams { typedef struct DiracDecoderParams {
/** decoder handle */ /** decoder handle */
dirac_decoder_t* p_decoder; dirac_decoder_t* p_decoder;
/** buffer to hold decoded frame */ /** buffer to hold decoded frame */
unsigned char* p_out_frame_buf; unsigned char* p_out_frame_buf;
} FfmpegDiracDecoderParams; } DiracDecoderParams;
/** /**
* returns Libav chroma format * returns Libav chroma format
*/ */
static enum PixelFormat GetFfmpegChromaFormat(dirac_chroma_t dirac_pix_fmt) static enum PixelFormat get_chroma_format(dirac_chroma_t dirac_pix_fmt)
{ {
int num_formats = sizeof(ffmpeg_dirac_pixel_format_map) / int num_formats = sizeof(dirac_pixel_format_map) /
sizeof(ffmpeg_dirac_pixel_format_map[0]); sizeof(dirac_pixel_format_map[0]);
int idx; int idx;
for (idx = 0; idx < num_formats; ++idx) for (idx = 0; idx < num_formats; ++idx)
if (ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt) if (dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt)
return ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt; return dirac_pixel_format_map[idx].ff_pix_fmt;
return PIX_FMT_NONE; return PIX_FMT_NONE;
} }
static av_cold int libdirac_decode_init(AVCodecContext *avccontext) static av_cold int libdirac_decode_init(AVCodecContext *avccontext)
{ {
FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data; DiracDecoderParams *p_dirac_params = avccontext->priv_data;
p_dirac_params->p_decoder = dirac_decoder_init(avccontext->debug); p_dirac_params->p_decoder = dirac_decoder_init(avccontext->debug);
if (!p_dirac_params->p_decoder) if (!p_dirac_params->p_decoder)
@ -80,7 +80,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext,
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data; DiracDecoderParams *p_dirac_params = avccontext->priv_data;
AVPicture *picture = data; AVPicture *picture = data;
AVPicture pic; AVPicture pic;
int pict_size; int pict_size;
@ -117,7 +117,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext,
avccontext->height = src_params->height; avccontext->height = src_params->height;
avccontext->width = src_params->width; avccontext->width = src_params->width;
avccontext->pix_fmt = GetFfmpegChromaFormat(src_params->chroma); avccontext->pix_fmt = get_chroma_format(src_params->chroma);
if (avccontext->pix_fmt == PIX_FMT_NONE) { if (avccontext->pix_fmt == PIX_FMT_NONE) {
av_log(avccontext, AV_LOG_ERROR, av_log(avccontext, AV_LOG_ERROR,
"Dirac chroma format %d not supported currently\n", "Dirac chroma format %d not supported currently\n",
@ -174,7 +174,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext,
static av_cold int libdirac_decode_close(AVCodecContext *avccontext) static av_cold int libdirac_decode_close(AVCodecContext *avccontext)
{ {
FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data; DiracDecoderParams *p_dirac_params = avccontext->priv_data;
dirac_decoder_close(p_dirac_params->p_decoder); dirac_decoder_close(p_dirac_params->p_decoder);
av_freep(&p_dirac_params->p_out_frame_buf); av_freep(&p_dirac_params->p_out_frame_buf);
@ -198,7 +198,7 @@ AVCodec ff_libdirac_decoder = {
.name = "libdirac", .name = "libdirac",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_DIRAC, .id = CODEC_ID_DIRAC,
.priv_data_size = sizeof(FfmpegDiracDecoderParams), .priv_data_size = sizeof(DiracDecoderParams),
.init = libdirac_decode_init, .init = libdirac_decode_init,
.close = libdirac_decode_close, .close = libdirac_decode_close,
.decode = libdirac_decode_frame, .decode = libdirac_decode_frame,

@ -38,7 +38,7 @@
#include <libdirac_encoder/dirac_encoder.h> #include <libdirac_encoder/dirac_encoder.h>
/** Dirac encoder private data */ /** Dirac encoder private data */
typedef struct FfmpegDiracEncoderParams { typedef struct DiracEncoderParams {
/** Dirac encoder context */ /** Dirac encoder context */
dirac_encoder_context_t enc_ctx; dirac_encoder_context_t enc_ctx;
@ -61,27 +61,27 @@ typedef struct FfmpegDiracEncoderParams {
int enc_buf_size; int enc_buf_size;
/** queue storing encoded frames */ /** queue storing encoded frames */
FfmpegDiracSchroQueue enc_frame_queue; DiracSchroQueue enc_frame_queue;
/** end of sequence signalled by user, 0 - false, 1 - true */ /** end of sequence signalled by user, 0 - false, 1 - true */
int eos_signalled; int eos_signalled;
/** end of sequence returned by encoder, 0 - false, 1 - true */ /** end of sequence returned by encoder, 0 - false, 1 - true */
int eos_pulled; int eos_pulled;
} FfmpegDiracEncoderParams; } DiracEncoderParams;
/** /**
* Works out Dirac-compatible chroma format. * Works out Dirac-compatible chroma format.
*/ */
static dirac_chroma_t GetDiracChromaFormat(enum PixelFormat ff_pix_fmt) static dirac_chroma_t GetDiracChromaFormat(enum PixelFormat ff_pix_fmt)
{ {
int num_formats = sizeof(ffmpeg_dirac_pixel_format_map) / int num_formats = sizeof(dirac_pixel_format_map) /
sizeof(ffmpeg_dirac_pixel_format_map[0]); sizeof(dirac_pixel_format_map[0]);
int idx; int idx;
for (idx = 0; idx < num_formats; ++idx) for (idx = 0; idx < num_formats; ++idx)
if (ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt == ff_pix_fmt) if (dirac_pixel_format_map[idx].ff_pix_fmt == ff_pix_fmt)
return ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt; return dirac_pixel_format_map[idx].dirac_pix_fmt;
return formatNK; return formatNK;
} }
@ -127,7 +127,7 @@ static VideoFormat GetDiracVideoFormatPreset(AVCodecContext *avccontext)
static av_cold int libdirac_encode_init(AVCodecContext *avccontext) static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
{ {
FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data; DiracEncoderParams* p_dirac_params = avccontext->priv_data;
int no_local = 1; int no_local = 1;
int verbose = avccontext->debug; int verbose = avccontext->debug;
VideoFormat preset; VideoFormat preset;
@ -219,7 +219,7 @@ static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
static void DiracFreeFrame(void *data) static void DiracFreeFrame(void *data)
{ {
FfmpegDiracSchroEncodedFrame *enc_frame = data; DiracSchroEncodedFrame *enc_frame = data;
av_freep(&(enc_frame->p_encbuf)); av_freep(&(enc_frame->p_encbuf));
av_free(enc_frame); av_free(enc_frame);
@ -231,9 +231,9 @@ static int libdirac_encode_frame(AVCodecContext *avccontext,
{ {
int enc_size = 0; int enc_size = 0;
dirac_encoder_state_t state; dirac_encoder_state_t state;
FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data; DiracEncoderParams *p_dirac_params = avccontext->priv_data;
FfmpegDiracSchroEncodedFrame* p_frame_output = NULL; DiracSchroEncodedFrame *p_frame_output = NULL;
FfmpegDiracSchroEncodedFrame* p_next_output_frame = NULL; DiracSchroEncodedFrame *p_next_output_frame = NULL;
int go = 1; int go = 1;
int last_frame_in_sequence = 0; int last_frame_in_sequence = 0;
@ -303,7 +303,7 @@ static int libdirac_encode_frame(AVCodecContext *avccontext,
break; break;
/* create output frame */ /* create output frame */
p_frame_output = av_mallocz(sizeof(FfmpegDiracSchroEncodedFrame)); p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame));
/* set output data */ /* set output data */
p_frame_output->size = p_dirac_params->enc_buf_size; p_frame_output->size = p_dirac_params->enc_buf_size;
p_frame_output->p_encbuf = p_dirac_params->enc_buf; p_frame_output->p_encbuf = p_dirac_params->enc_buf;
@ -371,7 +371,7 @@ static int libdirac_encode_frame(AVCodecContext *avccontext,
static av_cold int libdirac_encode_close(AVCodecContext *avccontext) static av_cold int libdirac_encode_close(AVCodecContext *avccontext)
{ {
FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data; DiracEncoderParams *p_dirac_params = avccontext->priv_data;
/* close the encoder */ /* close the encoder */
dirac_encoder_close(p_dirac_params->p_encoder); dirac_encoder_close(p_dirac_params->p_encoder);
@ -395,7 +395,7 @@ AVCodec ff_libdirac_encoder = {
.name = "libdirac", .name = "libdirac",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_DIRAC, .id = CODEC_ID_DIRAC,
.priv_data_size = sizeof(FfmpegDiracEncoderParams), .priv_data_size = sizeof(DiracEncoderParams),
.init = libdirac_encode_init, .init = libdirac_encode_init,
.encode = libdirac_encode_frame, .encode = libdirac_encode_frame,
.close = libdirac_encode_close, .close = libdirac_encode_close,

@ -64,14 +64,14 @@ SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext
int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt, int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
SchroFrameFormat *schro_frame_fmt) SchroFrameFormat *schro_frame_fmt)
{ {
unsigned int num_formats = sizeof(ffmpeg_schro_pixel_format_map) / unsigned int num_formats = sizeof(schro_pixel_format_map) /
sizeof(ffmpeg_schro_pixel_format_map[0]); sizeof(schro_pixel_format_map[0]);
int idx; int idx;
for (idx = 0; idx < num_formats; ++idx) { for (idx = 0; idx < num_formats; ++idx) {
if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) { if (schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) {
*schro_frame_fmt = ffmpeg_schro_pixel_format_map[idx].schro_frame_fmt; *schro_frame_fmt = schro_pixel_format_map[idx].schro_frame_fmt;
return 0; return 0;
} }
} }

@ -34,7 +34,7 @@ static const struct {
enum PixelFormat ff_pix_fmt; enum PixelFormat ff_pix_fmt;
SchroChromaFormat schro_pix_fmt; SchroChromaFormat schro_pix_fmt;
SchroFrameFormat schro_frame_fmt; SchroFrameFormat schro_frame_fmt;
} ffmpeg_schro_pixel_format_map[] = { } schro_pixel_format_map[] = {
{ PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 }, { PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 },
{ PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 }, { PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 },
{ PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 }, { PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 },

@ -41,7 +41,7 @@
#include <schroedinger/schrovideoformat.h> #include <schroedinger/schrovideoformat.h>
/** libschroedinger decoder private data */ /** libschroedinger decoder private data */
typedef struct FfmpegSchroDecoderParams { typedef struct SchroDecoderParams {
/** Schroedinger video format */ /** Schroedinger video format */
SchroVideoFormat *format; SchroVideoFormat *format;
@ -52,7 +52,7 @@ typedef struct FfmpegSchroDecoderParams {
SchroDecoder* decoder; SchroDecoder* decoder;
/** queue storing decoded frames */ /** queue storing decoded frames */
FfmpegDiracSchroQueue dec_frame_queue; DiracSchroQueue dec_frame_queue;
/** end of sequence signalled */ /** end of sequence signalled */
int eos_signalled; int eos_signalled;
@ -62,25 +62,25 @@ typedef struct FfmpegSchroDecoderParams {
/** decoded picture */ /** decoded picture */
AVPicture dec_pic; AVPicture dec_pic;
} FfmpegSchroDecoderParams; } SchroDecoderParams;
typedef struct FfmpegSchroParseUnitContext { typedef struct SchroParseUnitContext {
const uint8_t *buf; const uint8_t *buf;
int buf_size; int buf_size;
} FfmpegSchroParseUnitContext; } SchroParseUnitContext;
static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
void *priv); void *priv);
static void FfmpegSchroParseContextInit(FfmpegSchroParseUnitContext *parse_ctx, static void SchroParseContextInit(SchroParseUnitContext *parse_ctx,
const uint8_t *buf, int buf_size) const uint8_t *buf, int buf_size)
{ {
parse_ctx->buf = buf; parse_ctx->buf = buf;
parse_ctx->buf_size = buf_size; parse_ctx->buf_size = buf_size;
} }
static SchroBuffer* FfmpegFindNextSchroParseUnit(FfmpegSchroParseUnitContext *parse_ctx) static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
{ {
SchroBuffer *enc_buf = NULL; SchroBuffer *enc_buf = NULL;
int next_pu_offset = 0; int next_pu_offset = 0;
@ -120,22 +120,22 @@ static SchroBuffer* FfmpegFindNextSchroParseUnit(FfmpegSchroParseUnitContext *pa
/** /**
* Returns Libav chroma format. * Returns Libav chroma format.
*/ */
static enum PixelFormat GetFfmpegChromaFormat(SchroChromaFormat schro_pix_fmt) static enum PixelFormat get_chroma_format(SchroChromaFormat schro_pix_fmt)
{ {
int num_formats = sizeof(ffmpeg_schro_pixel_format_map) / int num_formats = sizeof(schro_pixel_format_map) /
sizeof(ffmpeg_schro_pixel_format_map[0]); sizeof(schro_pixel_format_map[0]);
int idx; int idx;
for (idx = 0; idx < num_formats; ++idx) for (idx = 0; idx < num_formats; ++idx)
if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) if (schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt)
return ffmpeg_schro_pixel_format_map[idx].ff_pix_fmt; return schro_pixel_format_map[idx].ff_pix_fmt;
return PIX_FMT_NONE; return PIX_FMT_NONE;
} }
static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext) static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext)
{ {
FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data; SchroDecoderParams *p_schro_params = avccontext->priv_data;
/* First of all, initialize our supporting libraries. */ /* First of all, initialize our supporting libraries. */
schro_init(); schro_init();
@ -164,7 +164,7 @@ static void libschroedinger_decode_frame_free(void *frame)
static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext) static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
{ {
FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data; SchroDecoderParams *p_schro_params = avccontext->priv_data;
SchroDecoder *decoder = p_schro_params->decoder; SchroDecoder *decoder = p_schro_params->decoder;
p_schro_params->format = schro_decoder_get_video_format(decoder); p_schro_params->format = schro_decoder_get_video_format(decoder);
@ -179,7 +179,7 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
} }
avccontext->height = p_schro_params->format->height; avccontext->height = p_schro_params->format->height;
avccontext->width = p_schro_params->format->width; avccontext->width = p_schro_params->format->width;
avccontext->pix_fmt = GetFfmpegChromaFormat(p_schro_params->format->chroma_format); avccontext->pix_fmt = get_chroma_format(p_schro_params->format->chroma_format);
if (ff_get_schro_frame_format(p_schro_params->format->chroma_format, if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,
&p_schro_params->frame_format) == -1) { &p_schro_params->frame_format) == -1) {
@ -206,7 +206,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data; SchroDecoderParams *p_schro_params = avccontext->priv_data;
SchroDecoder *decoder = p_schro_params->decoder; SchroDecoder *decoder = p_schro_params->decoder;
AVPicture *picture = data; AVPicture *picture = data;
SchroBuffer *enc_buf; SchroBuffer *enc_buf;
@ -214,11 +214,11 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
int state; int state;
int go = 1; int go = 1;
int outer = 1; int outer = 1;
FfmpegSchroParseUnitContext parse_ctx; SchroParseUnitContext parse_ctx;
*data_size = 0; *data_size = 0;
FfmpegSchroParseContextInit(&parse_ctx, buf, buf_size); SchroParseContextInit(&parse_ctx, buf, buf_size);
if (!buf_size) { if (!buf_size) {
if (!p_schro_params->eos_signalled) { if (!p_schro_params->eos_signalled) {
state = schro_decoder_push_end_of_stream(decoder); state = schro_decoder_push_end_of_stream(decoder);
@ -228,7 +228,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
/* Loop through all the individual parse units in the input buffer */ /* Loop through all the individual parse units in the input buffer */
do { do {
if ((enc_buf = FfmpegFindNextSchroParseUnit(&parse_ctx))) { if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) {
/* Push buffer into decoder. */ /* Push buffer into decoder. */
if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&
SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0)
@ -314,7 +314,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext) static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext)
{ {
FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data; SchroDecoderParams *p_schro_params = avccontext->priv_data;
/* Free the decoder. */ /* Free the decoder. */
schro_decoder_free(p_schro_params->decoder); schro_decoder_free(p_schro_params->decoder);
av_freep(&p_schro_params->format); av_freep(&p_schro_params->format);
@ -332,7 +332,7 @@ static void libschroedinger_flush(AVCodecContext *avccontext)
{ {
/* Got a seek request. Free the decoded frames queue and then reset /* Got a seek request. Free the decoded frames queue and then reset
* the decoder */ * the decoder */
FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data; SchroDecoderParams *p_schro_params = avccontext->priv_data;
/* Free data in the output frame queue. */ /* Free data in the output frame queue. */
ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue,
@ -348,7 +348,7 @@ AVCodec ff_libschroedinger_decoder = {
.name = "libschroedinger", .name = "libschroedinger",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_DIRAC, .id = CODEC_ID_DIRAC,
.priv_data_size = sizeof(FfmpegSchroDecoderParams), .priv_data_size = sizeof(SchroDecoderParams),
.init = libschroedinger_decode_init, .init = libschroedinger_decode_init,
.close = libschroedinger_decode_close, .close = libschroedinger_decode_close,
.decode = libschroedinger_decode_frame, .decode = libschroedinger_decode_frame,

@ -41,7 +41,7 @@
/** libschroedinger encoder private data */ /** libschroedinger encoder private data */
typedef struct FfmpegSchroEncoderParams { typedef struct SchroEncoderParams {
/** Schroedinger video format */ /** Schroedinger video format */
SchroVideoFormat *format; SchroVideoFormat *format;
@ -64,31 +64,31 @@ typedef struct FfmpegSchroEncoderParams {
int enc_buf_size; int enc_buf_size;
/** queue storing encoded frames */ /** queue storing encoded frames */
FfmpegDiracSchroQueue enc_frame_queue; DiracSchroQueue enc_frame_queue;
/** end of sequence signalled */ /** end of sequence signalled */
int eos_signalled; int eos_signalled;
/** end of sequence pulled */ /** end of sequence pulled */
int eos_pulled; int eos_pulled;
} FfmpegSchroEncoderParams; } SchroEncoderParams;
/** /**
* Works out Schro-compatible chroma format. * Works out Schro-compatible chroma format.
*/ */
static int SetSchroChromaFormat(AVCodecContext *avccontext) static int SetSchroChromaFormat(AVCodecContext *avccontext)
{ {
int num_formats = sizeof(ffmpeg_schro_pixel_format_map) / int num_formats = sizeof(schro_pixel_format_map) /
sizeof(ffmpeg_schro_pixel_format_map[0]); sizeof(schro_pixel_format_map[0]);
int idx; int idx;
FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data; SchroEncoderParams *p_schro_params = avccontext->priv_data;
for (idx = 0; idx < num_formats; ++idx) { for (idx = 0; idx < num_formats; ++idx) {
if (ffmpeg_schro_pixel_format_map[idx].ff_pix_fmt == if (schro_pixel_format_map[idx].ff_pix_fmt ==
avccontext->pix_fmt) { avccontext->pix_fmt) {
p_schro_params->format->chroma_format = p_schro_params->format->chroma_format =
ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt; schro_pixel_format_map[idx].schro_pix_fmt;
return 0; return 0;
} }
} }
@ -102,7 +102,7 @@ static int SetSchroChromaFormat(AVCodecContext *avccontext)
static int libschroedinger_encode_init(AVCodecContext *avccontext) static int libschroedinger_encode_init(AVCodecContext *avccontext)
{ {
FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data; SchroEncoderParams *p_schro_params = avccontext->priv_data;
SchroVideoFormatEnum preset; SchroVideoFormatEnum preset;
/* Initialize the libraries that libschroedinger depends on. */ /* Initialize the libraries that libschroedinger depends on. */
@ -238,7 +238,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext, static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
void *in_data) void *in_data)
{ {
FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data; SchroEncoderParams *p_schro_params = avccontext->priv_data;
SchroFrame *in_frame; SchroFrame *in_frame;
/* Input line size may differ from what the codec supports. Especially /* Input line size may differ from what the codec supports. Especially
* when transcoding from one format to another. So use avpicture_layout * when transcoding from one format to another. So use avpicture_layout
@ -256,7 +256,7 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
static void SchroedingerFreeFrame(void *data) static void SchroedingerFreeFrame(void *data)
{ {
FfmpegDiracSchroEncodedFrame *enc_frame = data; DiracSchroEncodedFrame *enc_frame = data;
av_freep(&(enc_frame->p_encbuf)); av_freep(&(enc_frame->p_encbuf));
av_free(enc_frame); av_free(enc_frame);
@ -267,9 +267,9 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
int buf_size, void *data) int buf_size, void *data)
{ {
int enc_size = 0; int enc_size = 0;
FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data; SchroEncoderParams *p_schro_params = avccontext->priv_data;
SchroEncoder *encoder = p_schro_params->encoder; SchroEncoder *encoder = p_schro_params->encoder;
struct FfmpegDiracSchroEncodedFrame* p_frame_output = NULL; struct DiracSchroEncodedFrame *p_frame_output = NULL;
int go = 1; int go = 1;
SchroBuffer *enc_buf; SchroBuffer *enc_buf;
int presentation_frame; int presentation_frame;
@ -328,7 +328,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
} }
/* Create output frame. */ /* Create output frame. */
p_frame_output = av_mallocz(sizeof(FfmpegDiracSchroEncodedFrame)); p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame));
/* Set output data. */ /* Set output data. */
p_frame_output->size = p_schro_params->enc_buf_size; p_frame_output->size = p_schro_params->enc_buf_size;
p_frame_output->p_encbuf = p_schro_params->enc_buf; p_frame_output->p_encbuf = p_schro_params->enc_buf;
@ -400,8 +400,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
static int libschroedinger_encode_close(AVCodecContext *avccontext) static int libschroedinger_encode_close(AVCodecContext *avccontext)
{ {
SchroEncoderParams *p_schro_params = avccontext->priv_data;
FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
/* Close the encoder. */ /* Close the encoder. */
schro_encoder_free(p_schro_params->encoder); schro_encoder_free(p_schro_params->encoder);
@ -426,7 +425,7 @@ AVCodec ff_libschroedinger_encoder = {
.name = "libschroedinger", .name = "libschroedinger",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_DIRAC, .id = CODEC_ID_DIRAC,
.priv_data_size = sizeof(FfmpegSchroEncoderParams), .priv_data_size = sizeof(SchroEncoderParams),
.init = libschroedinger_encode_init, .init = libschroedinger_encode_init,
.encode = libschroedinger_encode_frame, .encode = libschroedinger_encode_frame,
.close = libschroedinger_encode_close, .close = libschroedinger_encode_close,

Loading…
Cancel
Save