Commit 17384b17 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '5e5583ef'

* commit '5e5583ef':
  libavformat: add AC3 RTP depacketization (RFC 4184)

Conflicts:
	Changelog
	libavformat/rtpdec_ac3.c
	libavformat/version.h

See: 3eec775bMerged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 285eea00 5e5583ef
...@@ -24,7 +24,7 @@ version <next>: ...@@ -24,7 +24,7 @@ version <next>:
- ported softpulldown filter from libmpcodecs as repeatfields filter - ported softpulldown filter from libmpcodecs as repeatfields filter
- dcshift filter - dcshift filter
- RTP parser for loss tolerant payload format for MP3 audio (RFC 5219) - RTP parser for loss tolerant payload format for MP3 audio (RFC 5219)
- RTP parser for AC3 payload format (RFC 4184) - RTP depacketizer for AC3 payload format (RFC 4184)
- palettegen and paletteuse filters - palettegen and paletteuse filters
- VP9 RTP payload format (draft 0) experimental depacketizer - VP9 RTP payload format (draft 0) experimental depacketizer
- DV RTP payload format (RFC 6469) depacketizer - DV RTP payload format (RFC 6469) depacketizer
......
...@@ -32,7 +32,7 @@ struct PayloadContext { ...@@ -32,7 +32,7 @@ struct PayloadContext {
}; };
static av_cold int ac3_init(AVFormatContext *s, int st_index, static av_cold int ac3_init(AVFormatContext *s, int st_index,
PayloadContext *data) PayloadContext *data)
{ {
if (st_index < 0) if (st_index < 0)
return 0; return 0;
...@@ -45,7 +45,7 @@ static PayloadContext *ac3_new_context(void) ...@@ -45,7 +45,7 @@ static PayloadContext *ac3_new_context(void)
return av_mallocz(sizeof(PayloadContext)); return av_mallocz(sizeof(PayloadContext));
} }
static inline void free_fragment_if_needed(PayloadContext *data) static void free_fragment(PayloadContext *data)
{ {
if (data->fragment) { if (data->fragment) {
uint8_t *p; uint8_t *p;
...@@ -57,14 +57,14 @@ static inline void free_fragment_if_needed(PayloadContext *data) ...@@ -57,14 +57,14 @@ static inline void free_fragment_if_needed(PayloadContext *data)
static void ac3_free_context(PayloadContext *data) static void ac3_free_context(PayloadContext *data)
{ {
free_fragment_if_needed(data); free_fragment(data);
av_free(data); av_free(data);
} }
static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data, static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
AVStream *st, AVPacket *pkt, uint32_t *timestamp, AVStream *st, AVPacket *pkt, uint32_t *timestamp,
const uint8_t *buf, int len, uint16_t seq, const uint8_t *buf, int len, uint16_t seq,
int flags) int flags)
{ {
unsigned frame_type; unsigned frame_type;
unsigned nr_frames; unsigned nr_frames;
...@@ -97,7 +97,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data, ...@@ -97,7 +97,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
case 1: case 1:
case 2: /* First fragment */ case 2: /* First fragment */
free_fragment_if_needed(data); free_fragment(data);
data->last_frame = 1; data->last_frame = 1;
data->nr_frames = nr_frames; data->nr_frames = nr_frames;
...@@ -117,7 +117,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data, ...@@ -117,7 +117,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
} }
if (nr_frames != data->nr_frames || if (nr_frames != data->nr_frames ||
data->timestamp != *timestamp) { data->timestamp != *timestamp) {
free_fragment_if_needed(data); free_fragment(data);
av_log(ctx, AV_LOG_ERROR, "Invalid packet received\n"); av_log(ctx, AV_LOG_ERROR, "Invalid packet received\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
...@@ -130,7 +130,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data, ...@@ -130,7 +130,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
if (data->last_frame != data->nr_frames) { if (data->last_frame != data->nr_frames) {
free_fragment_if_needed(data); free_fragment(data);
av_log(ctx, AV_LOG_ERROR, "Missed %d packets\n", av_log(ctx, AV_LOG_ERROR, "Missed %d packets\n",
data->nr_frames - data->last_frame); data->nr_frames - data->last_frame);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
...@@ -139,7 +139,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data, ...@@ -139,7 +139,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
err = ff_rtp_finalize_packet(pkt, &data->fragment, st->index); err = ff_rtp_finalize_packet(pkt, &data->fragment, st->index);
if (err < 0) { if (err < 0) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Error occurred when getting fragment buffer."); "Error occurred when getting fragment buffer.\n");
return err; return err;
} }
......
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 56 #define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 23 #define LIBAVFORMAT_VERSION_MINOR 23
#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment