libavcodec/pgssubdec.c File Reference

PGS subtitle decoder. More...

#include "avcodec.h"
#include "dsputil.h"
#include "colorspace.h"
#include "bytestream.h"

Go to the source code of this file.

Data Structures

struct  PGSSubPresentation
struct  PGSSubPicture
struct  PGSSubContext

Defines

#define RGBA(r, g, b, a)   (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))

Enumerations

enum  SegmentType {
  PALETTE_SEGMENT = 0x14, PICTURE_SEGMENT = 0x15, PRESENTATION_SEGMENT = 0x16, WINDOW_SEGMENT = 0x17,
  DISPLAY_SEGMENT = 0x80
}

Functions

static av_cold int init_decoder (AVCodecContext *avctx)
static av_cold int close_decoder (AVCodecContext *avctx)
static int decode_rle (AVCodecContext *avctx, AVSubtitle *sub, const uint8_t *buf, unsigned int buf_size)
 Decodes the RLE data.
static int parse_picture_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 Parses the picture segment packet.
static void parse_palette_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 Parses the palette segment packet.
static void parse_presentation_segment (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 Parses the presentation segment packet.
static int display_end_segment (AVCodecContext *avctx, void *data, const uint8_t *buf, int buf_size)
 Parses the display segment packet.
static int decode (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)

Variables

AVCodec pgssub_decoder


Detailed Description

PGS subtitle decoder.

Definition in file pgssubdec.c.


Define Documentation

#define RGBA ( r,
g,
b,
 )     (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))

Definition at line 34 of file pgssubdec.c.


Enumeration Type Documentation

Enumerator:
PALETTE_SEGMENT 
PICTURE_SEGMENT 
PRESENTATION_SEGMENT 
WINDOW_SEGMENT 
DISPLAY_SEGMENT 

Definition at line 36 of file pgssubdec.c.


Function Documentation

static av_cold int close_decoder ( AVCodecContext avctx  )  [static]

Definition at line 72 of file pgssubdec.c.

static int decode ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Definition at line 377 of file pgssubdec.c.

static int decode_rle ( AVCodecContext avctx,
AVSubtitle sub,
const uint8_t *  buf,
unsigned int  buf_size 
) [static]

Decodes the RLE data.

The subtitle is stored as an Run Length Encoded image.

Parameters:
avctx contains the current codec context
sub pointer to the processed subtitle data
buf pointer to the RLE data to process
buf_size size of the RLE data to process

Definition at line 92 of file pgssubdec.c.

static int display_end_segment ( AVCodecContext avctx,
void *  data,
const uint8_t *  buf,
int  buf_size 
) [static]

Parses the display segment packet.

The display segment controls the updating of the display.

Parameters:
avctx contains the current codec context
data pointer to the data pertaining the subtitle to display
buf pointer to the packet to process
buf_size size of packet to process
Todo:
TODO: Fix start time, relies on correct PTS, currently too late

segment, which is currently ignored as it clears

the subtitle too early.

Todo:
TODO: Fix end time, normally cleared by a second display

Definition at line 334 of file pgssubdec.c.

Referenced by decode().

static av_cold int init_decoder ( AVCodecContext avctx  )  [static]

Definition at line 65 of file pgssubdec.c.

static void parse_palette_segment ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

Parses the palette segment packet.

The palette segment contains details of the palette, a maximum of 256 colors can be defined.

Parameters:
avctx contains the current codec context
buf pointer to the packet to process
buf_size size of packet to process

Definition at line 217 of file pgssubdec.c.

Referenced by decode().

static int parse_picture_segment ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

Parses the picture segment packet.

The picture segment contains details on the sequence id, width, height and Run Length Encoded (RLE) bitmap data.

Parameters:
avctx contains the current codec context
buf pointer to the packet to process
buf_size size of packet to process
Todo:
TODO: Enable support for RLE data over multiple packets

Definition at line 154 of file pgssubdec.c.

Referenced by decode().

static void parse_presentation_segment ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

Parses the presentation segment packet.

The presentation segment contains details on the video width, video height, x & y subtitle position.

Parameters:
avctx contains the current codec context
buf pointer to the packet to process
buf_size size of packet to process
Todo:
TODO: Implement cropping

TODO: Implement forcing of subtitles

TODO: Blanking of subtitle

Definition at line 261 of file pgssubdec.c.

Referenced by decode().


Variable Documentation

Initial value:

 {
    "pgssub",
    AVMEDIA_TYPE_SUBTITLE,
    CODEC_ID_HDMV_PGS_SUBTITLE,
    sizeof(PGSSubContext),
    init_decoder,
    NULL,
    close_decoder,
    decode,
    .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
}

Definition at line 455 of file pgssubdec.c.


Generated on Fri Oct 26 02:36:53 2012 for FFmpeg by  doxygen 1.5.8