asfenc.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/dict.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "riff.h"
#include "asf.h"
#include <assert.h>
Include dependency graph for asfenc.c:

Go to the source code of this file.

Data Structures

struct  ASFContext
 

Macros

#define ASF_INDEXED_INTERVAL   10000000
 
#define ASF_INDEX_BLOCK   (1<<9)
 
#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE   0x2
 
#define ASF_PACKET_ERROR_CORRECTION_FLAGS
 
#define ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE   1
 
#define ASF_PPI_PROPERTY_FLAGS
 
#define ASF_PPI_LENGTH_TYPE_FLAGS   0
 
#define ASF_PAYLOAD_FLAGS   ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD
 
#define ASF_PPI_SEQUENCE_FIELD_SIZE   0
 
#define ASF_PPI_PACKET_LENGTH_FIELD_SIZE   0
 
#define ASF_PPI_PADDING_LENGTH_FIELD_SIZE   0
 
#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE   1
 
#define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE   4
 
#define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE   1
 
#define ASF_PAYLOAD_LENGTH_FIELD_SIZE   2
 
#define PACKET_HEADER_MIN_SIZE
 
#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH   0x08
 
#define PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD
 
#define PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS
 
#define SINGLE_PAYLOAD_DATA_LENGTH
 
#define MULTI_PAYLOAD_CONSTANT
 
#define PREROLL_TIME   3100
 

Functions

void ff_put_guid (AVIOContext *s, const ff_asf_guid *g)
 
static void put_str16 (AVIOContext *s, const char *tag)
 
static int64_t put_header (AVIOContext *pb, const ff_asf_guid *g)
 
static void end_header (AVIOContext *pb, int64_t pos)
 
static void put_chunk (AVFormatContext *s, int type, int payload_length, int flags)
 
static int64_t unix_to_file_time (int ti)
 
static int asf_write_header1 (AVFormatContext *s, int64_t file_size, int64_t data_chunk_size)
 
static int asf_write_header (AVFormatContext *s)
 
static int asf_write_stream_header (AVFormatContext *s)
 
static int put_payload_parsing_info (AVFormatContext *s, unsigned sendtime, unsigned duration, int nb_payloads, int padsize)
 
static void flush_packet (AVFormatContext *s)
 
static void put_payload_header (AVFormatContext *s, ASFStream *stream, int64_t presentation_time, int m_obj_size, int m_obj_offset, int payload_len, int flags)
 
static void put_frame (AVFormatContext *s, ASFStream *stream, AVStream *avst, int64_t timestamp, const uint8_t *buf, int m_obj_size, int flags)
 
static void update_index (AVFormatContext *s, int start_sec, uint32_t packet_number, uint16_t packet_count)
 
static int asf_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int asf_write_index (AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count)
 
static int asf_write_trailer (AVFormatContext *s)
 

Variables

static const AVCodecTag codec_asf_bmp_tags []
 

Macro Definition Documentation

#define ASF_INDEX_BLOCK   (1<<9)

Definition at line 35 of file asfenc.c.

Referenced by asf_write_header(), and update_index().

#define ASF_INDEXED_INTERVAL   10000000

Definition at line 34 of file asfenc.c.

Referenced by asf_write_index(), and asf_write_packet().

#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE   0x2

Definition at line 37 of file asfenc.c.

Referenced by put_payload_parsing_info().

#define ASF_PACKET_ERROR_CORRECTION_FLAGS
Value:
#define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT
Definition: asf.h:123
#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE
Definition: asfenc.c:37

Definition at line 38 of file asfenc.c.

Referenced by put_payload_parsing_info().

#define ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE   1

Definition at line 43 of file asfenc.c.

#define ASF_PAYLOAD_FLAGS   ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD

Definition at line 56 of file asfenc.c.

Referenced by put_payload_parsing_info().

#define ASF_PAYLOAD_LENGTH_FIELD_SIZE   2

Definition at line 140 of file asfenc.c.

#define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE   1

Definition at line 124 of file asfenc.c.

#define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE   4

Definition at line 117 of file asfenc.c.

#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH   0x08

Definition at line 158 of file asfenc.c.

Referenced by put_payload_header().

#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE   1

Definition at line 98 of file asfenc.c.

#define ASF_PPI_LENGTH_TYPE_FLAGS   0

Definition at line 54 of file asfenc.c.

Referenced by put_payload_parsing_info().

#define ASF_PPI_PACKET_LENGTH_FIELD_SIZE   0

Definition at line 81 of file asfenc.c.

#define ASF_PPI_PADDING_LENGTH_FIELD_SIZE   0

Definition at line 94 of file asfenc.c.

#define ASF_PPI_PROPERTY_FLAGS
Value:

Definition at line 48 of file asfenc.c.

Referenced by put_payload_parsing_info().

#define ASF_PPI_SEQUENCE_FIELD_SIZE   0

Definition at line 68 of file asfenc.c.

#define MULTI_PAYLOAD_CONSTANT
Value:
1 - /* Payload Flags */ \
#define PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS
Definition: asfenc.c:167
#define PACKET_SIZE
Definition: asf.h:29
#define PACKET_HEADER_MIN_SIZE
Definition: asfenc.c:146

Definition at line 180 of file asfenc.c.

Referenced by put_frame().

#define PACKET_HEADER_MIN_SIZE
Value:
1 + /* Length Type Flags */ \
1 + /* Property Flags */ \
4 + /* Send Time Field */ \
2) /* Duration Field */
#define ASF_PPI_PACKET_LENGTH_FIELD_SIZE
Definition: asfenc.c:81
#define ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE
Definition: asfenc.c:43
#define ASF_PPI_PADDING_LENGTH_FIELD_SIZE
Definition: asfenc.c:94
#define ASF_PPI_SEQUENCE_FIELD_SIZE
Definition: asfenc.c:68
#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE
Definition: asfenc.c:37

Definition at line 146 of file asfenc.c.

Referenced by put_frame(), and put_payload_parsing_info().

#define PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS
Value:
(1 + /* Stream Number */ \
#define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE
Definition: asfenc.c:124
#define ASF_PAYLOAD_LENGTH_FIELD_SIZE
Definition: asfenc.c:140
#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH
Definition: asfenc.c:158
#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE
Definition: asfenc.c:98
#define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE
Definition: asfenc.c:117

Definition at line 167 of file asfenc.c.

Referenced by put_frame().

#define PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD
Value:
(1 + /* Stream Number */ \
#define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE
Definition: asfenc.c:124
#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH
Definition: asfenc.c:158
#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE
Definition: asfenc.c:98
#define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE
Definition: asfenc.c:117

Definition at line 160 of file asfenc.c.

Referenced by put_frame().

#define PREROLL_TIME   3100

Definition at line 220 of file asfenc.c.

Referenced by asf_write_header1(), asf_write_packet(), and put_frame().

#define SINGLE_PAYLOAD_DATA_LENGTH
Value:
#define PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD
Definition: asfenc.c:160
#define PACKET_SIZE
Definition: asf.h:29
#define PACKET_HEADER_MIN_SIZE
Definition: asfenc.c:146

Definition at line 175 of file asfenc.c.

Referenced by put_frame().

Function Documentation

static int asf_write_header ( AVFormatContext s)
static

Definition at line 548 of file asfenc.c.

Referenced by asf_write_stream_header(), and asf_write_trailer().

static int asf_write_header1 ( AVFormatContext s,
int64_t  file_size,
int64_t  data_chunk_size 
)
static

Definition at line 292 of file asfenc.c.

Referenced by asf_write_header(), and asf_write_trailer().

static int asf_write_index ( AVFormatContext s,
ASFIndex index,
uint16_t  max,
uint32_t  count 
)
static

Definition at line 829 of file asfenc.c.

Referenced by asf_write_trailer().

static int asf_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 791 of file asfenc.c.

Referenced by asf_write_trailer().

static int asf_write_stream_header ( AVFormatContext s)
static

Definition at line 581 of file asfenc.c.

Referenced by asf_write_trailer().

static int asf_write_trailer ( AVFormatContext s)
static

Definition at line 849 of file asfenc.c.

static void end_header ( AVIOContext pb,
int64_t  pos 
)
static

Definition at line 254 of file asfenc.c.

Referenced by asf_write_header1().

static void flush_packet ( AVFormatContext s)
static

Definition at line 638 of file asfenc.c.

Referenced by asf_write_trailer(), and put_frame().

static void put_chunk ( AVFormatContext s,
int  type,
int  payload_length,
int  flags 
)
static

Definition at line 265 of file asfenc.c.

Referenced by asf_write_header1(), asf_write_trailer(), and flush_packet().

static void put_frame ( AVFormatContext s,
ASFStream stream,
AVStream avst,
int64_t  timestamp,
const uint8_t buf,
int  m_obj_size,
int  flags 
)
static

Definition at line 700 of file asfenc.c.

Referenced by asf_write_packet().

static int64_t put_header ( AVIOContext pb,
const ff_asf_guid g 
)
static

Definition at line 243 of file asfenc.c.

Referenced by asf_write_header1().

static void put_payload_header ( AVFormatContext s,
ASFStream stream,
int64_t  presentation_time,
int  m_obj_size,
int  m_obj_offset,
int  payload_len,
int  flags 
)
static

Definition at line 669 of file asfenc.c.

Referenced by put_frame().

static int put_payload_parsing_info ( AVFormatContext s,
unsigned  sendtime,
unsigned  duration,
int  nb_payloads,
int  padsize 
)
static

Definition at line 590 of file asfenc.c.

Referenced by flush_packet().

static void put_str16 ( AVIOContext s,
const char *  tag 
)
static

Definition at line 228 of file asfenc.c.

Referenced by asf_write_header1().

static int64_t unix_to_file_time ( int  ti)
static

Definition at line 282 of file asfenc.c.

Referenced by asf_write_header1().

static void update_index ( AVFormatContext s,
int  start_sec,
uint32_t  packet_number,
uint16_t  packet_count 
)
static

Definition at line 763 of file asfenc.c.

Referenced by asf_write_packet(), and asf_write_trailer().

Variable Documentation

const AVCodecTag codec_asf_bmp_tags[]
static
Initial value:
= {
{ AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
{ AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
}
#define MKTAG(a, b, c, d)
Definition: common.h:282

Definition at line 213 of file asfenc.c.

Referenced by asf_write_trailer().