2 * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * data structures common to libschroedinger decoder and encoder
26 #ifndef AVCODEC_LIBSCHROEDINGER_H
27 #define AVCODEC_LIBSCHROEDINGER_H
29 #include <schroedinger/schrobitstream.h>
30 #include <schroedinger/schroframe.h>
34 typedef struct SchroVideoFormatInfo
{
37 uint16_t frame_rate_num
;
38 uint16_t frame_rate_denom
;
39 } SchroVideoFormatInfo
;
42 * contains a single encoded frame returned from Dirac or Schroedinger
44 typedef struct FFSchroEncodedFrame
{
45 /** encoded frame data */
48 /** encoded frame size */
51 /** encoded frame number. Will be used as pts */
54 /** key frame flag. 1 : is key frame , 0 : in not key frame */
56 } FFSchroEncodedFrame
;
61 typedef struct FFSchroQueueElement
{
62 /** Data to be stored in queue*/
64 /** Pointer to next element queue */
65 struct FFSchroQueueElement
*next
;
66 } FFSchroQueueElement
;
70 * A simple queue implementation used in libschroedinger
72 typedef struct FFSchroQueue
{
73 /** Pointer to head of queue */
74 FFSchroQueueElement
*p_head
;
75 /** Pointer to tail of queue */
76 FFSchroQueueElement
*p_tail
;
82 * Initialise the queue
84 void ff_schro_queue_init(FFSchroQueue
*queue
);
87 * Add an element to the end of the queue
89 int ff_schro_queue_push_back(FFSchroQueue
*queue
, void *p_data
);
92 * Return the first element in the queue
94 void *ff_schro_queue_pop(FFSchroQueue
*queue
);
97 * Free the queue resources. free_func is a function supplied by the caller to
98 * free any resources allocated by the caller. The data field of the queue
99 * element is passed to it.
101 void ff_schro_queue_free(FFSchroQueue
*queue
, void (*free_func
)(void *));
103 static const struct {
104 enum AVPixelFormat ff_pix_fmt
;
105 SchroChromaFormat schro_pix_fmt
;
106 SchroFrameFormat schro_frame_fmt
;
107 } schro_pixel_format_map
[] = {
108 { AV_PIX_FMT_YUV420P
, SCHRO_CHROMA_420
, SCHRO_FRAME_FORMAT_U8_420
},
109 { AV_PIX_FMT_YUV422P
, SCHRO_CHROMA_422
, SCHRO_FRAME_FORMAT_U8_422
},
110 { AV_PIX_FMT_YUV444P
, SCHRO_CHROMA_444
, SCHRO_FRAME_FORMAT_U8_444
},
114 * Returns the video format preset matching the input video dimensions and
117 SchroVideoFormatEnum
ff_get_schro_video_format_preset (AVCodecContext
*avctx
);
120 * Sets the Schroedinger frame format corresponding to the Schro chroma format
121 * passed. Returns 0 on success, -1 on failure.
123 int ff_get_schro_frame_format(SchroChromaFormat schro_chroma_fmt
,
124 SchroFrameFormat
*schro_frame_fmt
);
127 * Create a Schro frame based on the dimensions and frame format
128 * passed. Returns a pointer to a frame on success, NULL on failure.
130 SchroFrame
*ff_create_schro_frame(AVCodecContext
*avctx
,
131 SchroFrameFormat schro_frame_fmt
);
133 #endif /* AVCODEC_LIBSCHROEDINGER_H */